nwjs / nw.js

Call all Node.js modules directly from DOM/WebWorker and enable a new way of writing applications with all Web technologies.
https://nwjs.io
MIT License
40.31k stars 3.88k forks source link

AdSense trouble in NWjs #6099

Closed bambooCZ closed 6 years ago

bambooCZ commented 7 years ago

Hi,

I've encountered a bug in NWjs which prevents AdSense to work in some cases in NWjs.

It has something to do with iframe cross-origin access. It fails in webview and in top window frame also.

snimek obrazovky 2017-08-15 v 13 46 23

bambooCZ commented 7 years ago

Sorry - test app (compatible with Chrome and NWjs) adsense-trouble.zip

--disable-web-security solves the problem, but I can not send app to production with this flag.

Christywl commented 7 years ago

I can reproduce this issue on Linux/Windows with nwjs-sdk-v0.24.2.

bambooCZ commented 7 years ago

Any news?

rogerwang commented 6 years ago

Will see this soon.

rogerwang commented 6 years ago

I found the difference with NW and Chrome as the following. But with the minified JS it's hard to tell more information from it.

In the attached HTML downloaded from https://ad.doubleclick.net/ddm/adi/N9166.161769.PROZENY.CZ/B20104791.201578368;dc_ver=41.108;dc_eid=40004001;sz=300x600;osdl=1;u_sd=1;dc_adk=4037388879;ord=lfmoe0;click=https%3A%2F%2Fi.imedia.cz%2Fclickthru%3FspotId%3D0%26destination%3D;dc_rfl=0,https%3A%2F%2Fsos.seznam.cz%2Fcampaign%2FbannerPreviewScreen%3FbannerId%3D1394729%26onlyPreview%3D1$0;xdt=0;crlt=bey8qr3aAx;sttr=117;prcl=s?, only a small portion of function I is executed in NW. In Chrome the function E and F at the end of function I is executed. In NW only the line 287-290 and line 292-299 is executed. 1.zip

rogerwang commented 6 years ago

btw upstream chrome crashed when I tried to debug it in another way. filed issue here: https://bugs.chromium.org/p/chromium/issues/detail?id=775846

bambooCZ commented 6 years ago

Hi,

I've managed to isolate the issue. Try URL https://xn--mrvk-xpa.tk/test/

Basically document.querySelector("iframe").contentWindow.top throws exception in NWjs. Not in other browsers.

EDIT: Well, probably that is the issue :D

rogerwang commented 6 years ago

Great! This is very helpful. Will push a fix soon.

rogerwang commented 6 years ago

This is fixed in git and will be available in the next nightly build.

rogerwang commented 6 years ago

http://dl.nwjs.io/live-build/10-19-2017/nw26-c8b2590-4dce140-99d3829-e7da451/v0.26.1/