NWJS Version : sdk-0.25.0 (same in sdk-0.22.3)
Operating System : Win7, x64
window.parent.parent and window.parent.top should return a Window and shouldn't throw error in cross-origin iframe. It's behavior of Google Chrome.
VM346:1 Uncaught DOMException: Blocked a frame with origin "..." from accessing a cross-origin frame.
at <anonymous>:1:15
var iframe = document.createElement('iframe');
iframe.src = 'https://example.com/';
document.body.appendChild(iframe);
window.parent.parent (in "example.com" iframe)Google IMA is not working in NW.js because of exception in part of code
for (var f = 0; e != e.parent; )
f++,
e = e.parent;
where variable "e" is equal to "window".
You can check it on page: https://developers.google.com/interactive-media-ads/docs/sdks/html5/vastinspector
You will see cross-origin exceptions in console.
_Note please, that in version 0.25.0 page with Google IMA library becomes unresponsive on load, so you should use earlier versions for reproducing exactly this issue._
you can try adding this to package.json to avoid the cors error:
"chromium-args": "--disable-web-security",
I have used it already as a temporary solution, but it adds a serious vulnerability to app. So this issue is important to be fixed.
I can reproduce this issue on Linux/Windows with nwjs-sdk-v0.25.0.
This shares the same root cause and fixed in #6099 . Please reopen if it's not.
Most helpful comment
you can try adding this to package.json to avoid the cors error:
"chromium-args": "--disable-web-security",