In GWT framework there is a class JsoSplittable, which contains following code ($wnd
is reference to global window
object):
return $wnd.JSON && $wnd.JSON.stringify && $wnd.JSON.stringify({
b : function() {
}
}) == '{}';
I'm using this code in HTML5 web worker, which doesn't have access to window
(therefore global $wnd
can be redefined). How can I create in pure Javascript custom $wnd
object which will satisfy condition in snippet above?
True can be hardcoded, I will force modern browser anyway.
PS: patch to GWT will be submitted, but I also need workaround for legacy environment
I think this is your easiest bet
If you don't have access to
JSON
, you could stub that out too