From:  David Glasser <>
Date:  11 Jul 2013 03:15:27 Hong Kong Time

Inconsistency in implementation of )]} XSSI stripping.


In the Mozilla source-map library (which I believe is what FireFox
uses), )]} stripping is done like this:

      sourceMap = JSON.parse(aSourceMap.replace(/^\)\]\}'/, ''));

In WebKit and Blink, the code is more like:

        if (response.slice(0, 3) === ")]}")
            response = response.substring(response.indexOf('\n'));

The spec says:

   a line starting with the string “)]}'”

So it looks like if you start with the five characters
    )]}'  [newline]
it will work with both implementations, and that's technically what
the spec says.  But there are strings that will work with one but not
the other (leaving out the newline works for mozilla, leaving out the
single quote works for webkit).  Is this inconsistency intentional?
eg, is the single quote in the spec too hard to read (I certainly
didn't see it the first time I read it).

At the very least, could the spec be amended to be incredibly clear
that you need five characters (including the
currently-difficult-to-see single quote and the implicitly-mentioned
newline) for this to work consistently?  Otherwise, somebody trying to
interpret the spec by looking at one of the two implementations would
end up with incomplete information.