gwtquery
gwtquery copied to clipboard
$(window) causes exception when the page containing my gwt module is accessed by https
When my module is fetched by a page accessed via http, it is good, but when the page is accessed via https I get"
configure-0.js:14352 Uncaught com.google.gwt.core.client.JavaScriptException: (SecurityError) : Blocked a frame with origin "https://htmlhub.io" from accessing a cross-origin frame.
It is not a CORS issue, because the module does start up and runs ok until it encounter any attempt to access $(window); e.g. int w = $(window).width();
Digging deeper, the exception happens in JSUtils:
/**
- Check is a javascript can be cast to a node list. / public static native boolean isNodeList(JavaScriptObject o) /-{ var r = Object.prototype.toString.call(o); return r == '[object HTMLCollection]' || r == '[object NodeList]' || (typeof o == 'object' && o.length && o[0] && o[0].tagName) ? true : false; }-*/;
Get the exception when the return line executes. Just prior to the return, r is '[object Window']
Finally, by removing all references to GQuery.window and $(window) and instead using the gwt Window object the issue resolves.