yuvadm / free-haaretz

A nefarious browser extension that easily bypasses the haaretz{.co.il,.com} paywall
158 stars 19 forks source link

Error in onBeforeSendHeaders event handler #8

Closed yuvadm closed 7 years ago

yuvadm commented 9 years ago

This error shows up on the background page, seemingly without actually affecting behavior:

Error in event handler for webRequest.onBeforeSendHeaders/2: Invalid value for argument 4. Property 'url': Unexpected property.
Stack trace: Error: Invalid value for argument 4. Property 'url': Unexpected property.
    at validate (extensions::schemaUtils:34:13)
    at Object.normalizeArgumentsAndValidate (extensions::schemaUtils:117:3)
    at Object.<anonymous> (extensions::binding:307:30)
    at subEventCallback (extensions::webRequestInternal:89:28)
    at Function.target.(anonymous function) (extensions::SafeBuiltins:19:14)
    at EventImpl.dispatchToListener (extensions::event_bindings:397:22)
    at Function.target.(anonymous function) (extensions::SafeBuiltins:19:14)
    at Event.publicClass.(anonymous function) [as dispatchToListener] (extensions::utils:93:26)
    at EventImpl.dispatch_ (extensions::event_bindings:379:35)
    at dispatchArgs (extensions::event_bindings:247:26) extensions::uncaught_exception_handler:9handler extensions::uncaught_exception_handler:9exports.handle extensions::uncaught_exception_handler:15EventImpl.dispatch_ extensions::event_bindings:384dispatchArgs extensions::event_bindings:247dispatchEvent

Probably want to fix this.

yuvadm commented 7 years ago

Error nowhere to be seen

antishok commented 7 years ago

I'm still seeing it, FWIW, when going to the "Sources" tab in the devtools (on the haaretz page, not on the background page).

It makes sense I suppose, because they've changed how they load those urls you're trying to block - they are now minified, and opening the devtools loads the source-maps.

And regarding the error itself.. indeed the docs say it should be redirectUrl, not url.

yuvadm commented 7 years ago

@antishok heh, thanks for looking into this and replying! Any chance you wanna send a PR for this?

yuvadm commented 7 years ago

@antishok from what I can tell, there's no erorr since this block is never actually executed - it looks like the bots script is no longer referenced. I'll probably just remove the stale code.

antishok commented 7 years ago

@yuvadm yeah I agree that it's probably not needed anymore as it is now..

They are still loading those same scripts, but they are now bundled into 2 minified bundles:

So to block them it won't be as simple as blocking a list of urls (because those bundles contain other code unrelated to adblocking).

It seems right now that blocking them is not needed.. but a few weeks ago it suddenly stopped working for me - that's when I started noticing this error in the background-page - I thought it's the reason it's not working, but 2 days later it suddenly started working again. FYI :)

yuvadm commented 7 years ago

@antishok keep in mind I'm not trying to handle the anti adblock scripts, those are already handled in https://github.com/easylist/EasyListHebrew so the only extra functionality I'm adding here is the user agent change, and blocking of any specific anti-bot scripts.

antishok commented 7 years ago

@yuvadm I see.. well I guess those scripts are not interfering right now. It's just good to keep in mind that they are being loaded and executed - easylist doesn't block them (and I'm not sure it can).