chrome.webRequest.onBeforeRequest.addListener( blockSites, { urls: blockedSitesArray }, ['blocking'] );--
You received this message because you are subscribed to the Google Groups "Chromium-Extensions-Announce" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extensions+unsub...@chromium.org.
To post to this group, send email to chromium-extensions@chromium.org.
Visit this group at https://groups.google.com/a/chromium.org/group/chromium-extensions/.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-extensions/bfcf2d6c-0226-477f-a5ab-cc9f0b4ac320%40chromium.org.
For more options, visit https://groups.google.com/a/chromium.org/d/optout.
chrome.webRequest.onBeforeRequest.addListener( blockSites, { urls: blockedSitesArray }, ['blocking'] );
console.log("error?");
console.log(chrome.runtime.lastError);error?
undefined
Unchecked runtime.lastError while running webRequestInternal.addEventListener: '*://*.cnn.com' is not a valid URL pattern.Yep, I think you can check chrome.runtime.lastError right after the addListener call.
☆PhistucK
On Sun, Jan 15, 2017 at 12:21 AM, David Hirmes <hir...@gmail.com> wrote:
I'm blocking certain sites using:chrome.webRequest.onBeforeRequest.addListener( blockSites, { urls: blockedSitesArray }, ['blocking'] );
but if there is a syntax error in the blockedSitesArray (for instance if an item is included without a trailing slash, as in "https://www.google.com" instead of "https://www.google.com/") an error occurs and the blocking fails with this message:"Unchecked runtime.lastError while running webRequestInternal.addEventListener: 'http://www.cnn.com' is not a valid URL pattern."Since this array of URL patterns is created from user input, I can't guarantee it will be valid. Is there a way to at least capture the "Unchecked runtime.lastError" so I can warn the user of the error?
--
You received this message because you are subscribed to the Google Groups "Chromium-Extensions-Announce" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extensions+unsub...@chromium.org.
To post to this group, send email to chromium-...@chromium.org.
Unfortunately, that doesn't seem to work, perhaps because the addListener is done asynchronously?When I do:
chrome.webRequest.onBeforeRequest.addListener( blockSites, { urls: blockedSitesArray }, ['blocking'] );
console.log("error?");
console.log(chrome.runtime.lastError);I get:error?
undefined
Unchecked runtime.lastError while running webRequestInternal.addEventListener: '*://*.cnn.com' is not a valid URL pattern.
On Sunday, January 15, 2017 at 12:28:00 AM UTC-5, PhistucK wrote:
Yep, I think you can check chrome.runtime.lastError right after the addListener call.
☆PhistucK
On Sun, Jan 15, 2017 at 12:21 AM, David Hirmes <hir...@gmail.com> wrote:
I'm blocking certain sites using:chrome.webRequest.onBeforeRequest.addListener( blockSites, { urls: blockedSitesArray }, ['blocking'] );
but if there is a syntax error in the blockedSitesArray (for instance if an item is included without a trailing slash, as in "https://www.google.com" instead of "https://www.google.com/") an error occurs and the blocking fails with this message:"Unchecked runtime.lastError while running webRequestInternal.addEventListener: 'http://www.cnn.com' is not a valid URL pattern."Since this array of URL patterns is created from user input, I can't guarantee it will be valid. Is there a way to at least capture the "Unchecked runtime.lastError" so I can warn the user of the error?
--
You received this message because you are subscribed to the Google Groups "Chromium-Extensions-Announce" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extensions+unsubscribe...@chromium.org.
To post to this group, send email to chromium-...@chromium.org.
Visit this group at https://groups.google.com/a/chromium.org/group/chromium-extensions/.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-extensions/bfcf2d6c-0226-477f-a5ab-cc9f0b4ac320%40chromium.org.
For more options, visit https://groups.google.com/a/chromium.org/d/optout.
--
You received this message because you are subscribed to the Google Groups "Chromium-Extensions-Announce" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extensions+unsubscribe...@chromium.org.
To post to this group, send email to chromium-extensions@chromium.org.
Visit this group at https://groups.google.com/a/chromium.org/group/chromium-extensions/.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-extensions/8e61dc2c-4395-471c-b725-c88851df71c8%40chromium.org.
Unchecked runtime.lastError while running webRequestInternal.addEventListener: '<bad url>' is not a valid URL pattern.
☆PhistucK
☆PhistucK
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extensions+unsub...@chromium.org.
To post to this group, send email to chromium-...@chromium.org.
Visit this group at https://groups.google.com/a/chromium.org/group/chromium-extensions/.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-extensions/bfcf2d6c-0226-477f-a5ab-cc9f0b4ac320%40chromium.org.
For more options, visit https://groups.google.com/a/chromium.org/d/optout.
--
You received this message because you are subscribed to the Google Groups "Chromium-Extensions-Announce" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extensions+unsub...@chromium.org.
To post to this group, send email to chromium-...@chromium.org.
Visit this group at https://groups.google.com/a/chromium.org/group/chromium-extensions/.