Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Uncaught SyntaxError: Failed to execute 'querySelector' on 'Document' #693

Closed
zmni opened this issue Sep 8, 2015 · 2 comments
Closed

Uncaught SyntaxError: Failed to execute 'querySelector' on 'Document' #693

zmni opened this issue Sep 8, 2015 · 2 comments

Comments

@zmni
Copy link

zmni commented Sep 8, 2015

Happened on this page: https://www.microsoft.com/id-id/groove/onedrive

On Console:

Uncaught SyntaxError: Failed to execute 'querySelector' on 'Document': '
[onclick^="window.open('http://adultfriendfinder.com/search/"],
a[data-obtrack^="http://paid.outbrain.com/network/redir?"],
a[data-redirect^="this.href='http://paid.outbrain.com/network/redir?"],
a[href$="/vghd.shtml"],
a[href*="/adrotate-out.php?"],
[href^=" http://ads.ad-center.com/"],
[href^=" http://n47adshostnet.com/"],
[href^="//adbit.co/?a=Advertise&"],
[href^="//ads.ad-center.com/"],
[href^="//go.ad2up.com/"],
[href^="http://amzn.to/"] > img[src^="data"],
[href^="http://api.taboola.com/"][href*="/recommendations.notify-click?app.type="],
[href^="http://games.ucoz.ru/"][target="_blank"],
[href^="http://taboola-"][href*="/redirect.php?app.type="],
a[onmousedown^="this.href='http://paid.outbrain.com/network/redir?"][target="_blank"],
a[onmousedown^="this.href='http://paid.outbrain.com/network/redir?"][target="_blank"] + .ob_source,
a[onmousedown^="this.href='http://staffpicks.outbrain.com/network/redir?"][target="_blank"],
a[onmousedown^="this.href='http://staffpicks.outbrain.com/network/redir?"][target="_blank"] + .ob_source,
a[onmousedown^="this.href='https://paid.outbrain.com/network/redir?"][target="_blank"],
a[onmousedown^="this.href='https://paid.outbrain.com/network/redir?"][target="_blank"] + .ob_source,
a[style="display:block;width:300px;min-height:250px"][href^="http://li.cnet.com/click?"],
div[id^="MarketGid"],
div[id^="YFBMSN"],
div[id^="acm-ad-tag-"],
div[id^="div-gpt-ad-"],
iframe[id^="google_ads_frame"],
iframe[id^="google_ads_iframe"],
iframe[src^="http://ad.yieldmanager.com/"],
iframe[src^="http://cdn1.adexprt.com/"],
iframe[src^="http://cdn2.adexprt.com/"],
img[alt^="Fuckbook"],
input[onclick^="window.open('http://www.FriendlyDuck.com/AF_"],
input[onclick^="window.open('http://www.friendlyduck.com/AF_"],
p[id^="div-gpt-ad-"],
script[src^="http://free-shoutbox.net/app/webroot/shoutbox/sb.php?shoutbox="] + #freeshoutbox_content,
iframe[src^="http://static.mozo.com.au/strips/"],
td[valign="top"] > .mainmenu[style="padding:10px 0 0 0 !important;"],
div[id^="mainads"],
div[id^="zergnet-widget-"],
a[href*="facebook.com/share"],
a[href*="linkedin.com/share"],
a[href*="pinterest.com/pin"],
a[href*="plus.google.com/share"],
a[href*="reddit.com/submit"],
a[href*="share.flipboard.com"],
a[href*="stumbleupon.com/badge"],
a[href*="stumbleupon.com/submit"],
a[href*="twitter.com/intent"],
a[href*="twitter.com/share"],
[alt~="Share"],
[title~="Share"],
[class~="sharebar],
[class|="social-share"],
[class|="social-sharing"]' is not a valid selector.

    processHighHighGenerics @ chrome-extension://cjpalhdlnbpafiamejdnhcphjbkeiagm/js/contentscript-end.js:616

And error also on all selector character: *, ^, ~, |, $

Google Chrome v45.0.2454.85 m (64-bit)
uBlock Origin v1.1.0.0

@gorhill
Copy link
Owner

gorhill commented Sep 8, 2015

Bad CSS selector:

[class~="sharebar]

Correction:

[class~="sharebar"]

@gorhill gorhill closed this as completed Sep 8, 2015
@gorhill gorhill reopened this Sep 8, 2015
@gorhill
Copy link
Owner

gorhill commented Sep 8, 2015

Actually, uBlock Origin has code to detect and reject bad CSS selectors at compile-list time. The current case was not detected, and the bad CSS selector was not rejected. For some reasons, the browser does not throw with:

document.querySelector('[class~="sharebar]');

But throws with:

document.querySelector('[class~="sharebar],\n#foo');

Presumably because it keep trying to use whatever follow " as part of the attribute value, until a corresponding " is found. So I will modify the bad CSS selector detection code to deal with this quirk.

gorhill added a commit that referenced this issue Sep 8, 2015
@gorhill gorhill closed this as completed Sep 8, 2015
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants