Skip to content
This repository has been archived by the owner on Sep 15, 2021. It is now read-only.

Ad blockers causing exception to be thrown #51

Open
jknight12882 opened this issue Dec 5, 2016 · 9 comments
Open

Ad blockers causing exception to be thrown #51

jknight12882 opened this issue Dec 5, 2016 · 9 comments

Comments

@jknight12882
Copy link

... in the _addScript function, namely when the <script /> node is inserted into the DOM. These should be caught and returned in the callback

@ryan-roemer
Copy link
Contributor

@jknight12882 -- Can you give us a little more information and (if possible) a failing unit test case example?

Do you mean that something like:

try {
  _addScript(script);
} catch (err) {
  // We now have an `err` from the actual `_addScript()` call (?)
}

@jknight12882
Copy link
Author

The use case occurs when we try to load Omniture analytics tracking. The error is:

screen shot 2016-12-05 at 3 09 21 pm

Which refers to the (Uglified) _addScript function

screen shot 2016-12-05 at 3 09 35 pm

@ryan-roemer
Copy link
Contributor

Can you paste the stack trace / error message? I'm curious as to why it looks like t.parentNode doesn't have an insertBefore(n, t) or why that failed...

And reading what you've pasted, it looks like the GET fails for /vendor/s_code.min.js which theoretically should be handled by the error handlers by little-loader (assuming you're using the err object in the callback).

@ryan-roemer
Copy link
Contributor

Alternately, if the omniture stuff isn't closed source, you could maybe create a jsbin or something repro-ing your issue so we can dive in with more info?

@jknight12882
Copy link
Author

It's only handled if asynchronous. This is a synchronous error being thrown when trying to insert the dom. I'm using ublock which is looking at the name of the js being inserted and comparing it against a blacklist of known names, and then rejecting.

@ryan-roemer
Copy link
Contributor

Gotcha. Can you give me a full stack trace so I can see where I should be try/catch-ing? It looks around the insertBefore call?

@jknight12882
Copy link
Author

Best I can do at this exact moment as we're inlining and wrapping the library to allow for parallel loading of multiple scripts

screen shot 2016-12-05 at 3 24 33 pm

@jknight12882
Copy link
Author

screen shot 2016-12-05 at 3 27 00 pm

@ryan-roemer
Copy link
Contributor

Thanks for the info.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

2 participants