Commit 24284e28 authored by Dave Barker's avatar Dave Barker 🐈

Refs #56 - Drop support for Chrome 49 and 50

parent 8d2302f1
Pipeline #79404271 passed with stages
in 9 minutes and 40 seconds
......@@ -81,7 +81,7 @@ function injected(eventName, injectedIntoContentWindow)
);
// Apparently in HTMLObjectElement.prototype.contentWindow does not exist
// in older versions of Chrome such as 42.
// in older versions of Chrome such as 51.
if (!contentWindowDesc)
continue;
......@@ -303,7 +303,7 @@ function injected(eventName, injectedIntoContentWindow)
// Since the old webkitRTCPeerConnection constructor takes an optional
// second argument we need to take care to pass that through. Necessary
// for older versions of Chrome such as 49.
// for older versions of Chrome such as 51.
let constraints = undefined;
if (args.length > 1)
constraints = args[1];
......
......@@ -155,19 +155,12 @@ function executeScript(script, tabId, frameId)
{
try
{
let details = {
return browser.tabs.executeScript(tabId, {
code: getExecutableCode(script),
matchAboutBlank: true,
runAt: "document_start"
};
// Chrome <50 throws an exception if chrome.tabs.executeScript is called
// with a frameId of 0.
if (frameId != 0)
details.frameId = frameId;
return browser.tabs.executeScript(tabId, details)
.catch(error =>
runAt: "document_start",
frameId
}).catch(error =>
{
// Sometimes a frame is added and removed very quickly, in such cases we
// simply ignore the error.
......
......@@ -113,12 +113,6 @@ function logRequest(tabIds, request, filter)
browser.webRequest.onBeforeRequest.addListener(details =>
{
// This event doesn't fire in Chrome 49 for object requests when we filter by
// request type. So, we have to instead listen for all request types and
// manually ignore the ones we don't care about.
if (details.type == "main_frame")
return;
// Filter out requests from non web protocols. Ideally, we'd explicitly
// specify the protocols we are interested in (i.e. http://, https://,
// ws:// and wss://) with the url patterns, given below, when adding this
......@@ -206,6 +200,8 @@ browser.webRequest.onBeforeRequest.addListener(details =>
return result;
}, {
types: Object.values(browser.webRequest.ResourceType)
.filter(type => type != "main_frame"),
urls: ["<all_urls>"]
}, ["blocking"]);
......
......@@ -39,8 +39,8 @@ permissions =
notifications
[compat]
chrome = 49.0
opera = 36.0
chrome = 51.0
opera = 38.0
[contentScripts]
document_start =
......
......@@ -278,15 +278,6 @@
wrapRuntimeOnMessage();
}
// Workaround since HTMLCollection, NodeList, StyleSheetList, and CSSRuleList
// didn't have iterator support before Chrome 51.
// https://bugs.chromium.org/p/chromium/issues/detail?id=401699
for (let object of [HTMLCollection, NodeList, StyleSheetList, CSSRuleList])
{
if (!(Symbol.iterator in object.prototype))
object.prototype[Symbol.iterator] = Array.prototype[Symbol.iterator];
}
}
// Object.values is not supported in Chrome <54.
......@@ -323,32 +314,6 @@ if (browser.webRequest && !("ResourceType" in browser.webRequest))
}
}
// Chrome <50 does not support createImageBitmap, this is a simplistic
// polyfill which only fulfills the usecase of accepting a Blob containing
// an image and returning something which CanvasRenderingContext2D.drawImage()
// accepts.
if (typeof createImageBitmap == "undefined")
{
self.createImageBitmap = blob =>
{
return new Promise((resolve, reject) =>
{
let image = new Image();
image.src = URL.createObjectURL(blob);
image.addEventListener("load", () =>
{
URL.revokeObjectURL(image.src);
resolve(image);
});
image.addEventListener("error", () =>
{
URL.revokeObjectURL(image.src);
reject("createImageBitmap failed");
});
});
};
}
// Chrome <69 does not support OffscreenCanvas
if (typeof OffscreenCanvas == "undefined")
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment