mirror of https://github.com/gorhill/uBlock.git
code review to fix "javascript.options.strict" warnings in browser console of Firefox
This commit is contained in:
parent
7884cf70f6
commit
e5c2eff2d0
|
@ -1,7 +1,7 @@
|
|||
/*******************************************************************************
|
||||
|
||||
µBlock - a browser extension to block requests.
|
||||
Copyright (C) 2014 The µBlock authors
|
||||
uBlock Origin - a browser extension to block requests.
|
||||
Copyright (C) 2014-2106 The uBlock Origin authors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -62,7 +62,7 @@ var deferUntil = function(testFn, mainFn, details) {
|
|||
vAPI.setTimeout(check, next);
|
||||
};
|
||||
|
||||
if ( details.async === false ) {
|
||||
if ( 'sync' in details && details.sync === true ) {
|
||||
check();
|
||||
} else {
|
||||
vAPI.setTimeout(check, 1);
|
||||
|
@ -829,7 +829,7 @@ vAPI.tabs.get = function(tabId, callback) {
|
|||
id: tabId,
|
||||
index: tabWatcher.indexFromTarget(browser),
|
||||
windowId: winWatcher.idFromWindow(win),
|
||||
active: browser === tabBrowser.selectedBrowser,
|
||||
active: tabBrowser !== null && browser === tabBrowser.selectedBrowser,
|
||||
url: browser.currentURI.asciiSpec,
|
||||
title: browser.contentTitle
|
||||
});
|
||||
|
@ -921,6 +921,9 @@ vAPI.tabs.open = function(details) {
|
|||
|
||||
var win = winWatcher.getCurrentWindow();
|
||||
var tabBrowser = getTabBrowser(win);
|
||||
if ( tabBrowser === null ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( vAPI.fennec ) {
|
||||
tabBrowser.addTab(details.url, {
|
||||
|
@ -1430,7 +1433,7 @@ vAPI.setIcon = function(tabId, iconStatus, badge) {
|
|||
: winWatcher.getCurrentWindow();
|
||||
var curTabId;
|
||||
var tabBrowser = getTabBrowser(win);
|
||||
if ( tabBrowser ) {
|
||||
if ( tabBrowser !== null ) {
|
||||
curTabId = tabWatcher.tabIdFromTarget(tabBrowser.selectedTab);
|
||||
}
|
||||
var tb = vAPI.toolbarButton;
|
||||
|
@ -2038,12 +2041,12 @@ var httpObserver = {
|
|||
return false;
|
||||
}
|
||||
|
||||
if ( result.cancel === true ) {
|
||||
if ( 'cancel' in result && result.cancel === true ) {
|
||||
channel.cancel(this.ABORT);
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( result.redirectUrl ) {
|
||||
if ( 'redirectUrl' in result ) {
|
||||
channel.redirectionLimit = 1;
|
||||
channel.redirectTo(Services.io.newURI(result.redirectUrl, null, null));
|
||||
return true;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*******************************************************************************
|
||||
|
||||
µBlock - a browser extension to block requests.
|
||||
Copyright (C) 2014 The µBlock authors
|
||||
uBlock Origin - a browser extension to block requests.
|
||||
Copyright (C) 2014-2016 The uBlock Origin authors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -131,12 +131,15 @@ vAPI.messaging = {
|
|||
return;
|
||||
}
|
||||
var details = msg.details;
|
||||
if ( details.allFrames !== true && window !== window.top ) {
|
||||
// Whether to inject in all child frames. Default to only top frame.
|
||||
var allFrames = details.allFrames || false;
|
||||
if ( allFrames !== true && window !== window.top ) {
|
||||
return;
|
||||
}
|
||||
// https://github.com/gorhill/uBlock/issues/876
|
||||
// Enforce `details.runAt`. Default to `document_end`.
|
||||
if ( details.runAt === 'document_start' || document.readyState !== 'loading' ) {
|
||||
var runAt = details.runAt || 'document_end';
|
||||
if ( runAt === 'document_start' || document.readyState !== 'loading' ) {
|
||||
self.injectScript(details.file);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*******************************************************************************
|
||||
|
||||
uBlock - a browser extension to block requests.
|
||||
Copyright (C) 2014-2015 Raymond Hill
|
||||
uBlock Origin - a browser extension to block requests.
|
||||
Copyright (C) 2014-2016 Raymond Hill
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -131,7 +131,7 @@ var onMessage = function(request, sender, callback) {
|
|||
case 'launchElementPicker':
|
||||
// Launched from some auxiliary pages, clear context menu coords.
|
||||
µb.mouseX = µb.mouseY = -1;
|
||||
µb.elementPickerExec(request.tabId, request.targetURL);
|
||||
µb.elementPickerExec(request.tabId, request.targetURL || '');
|
||||
break;
|
||||
|
||||
case 'gotoURL':
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*******************************************************************************
|
||||
|
||||
uBlock - a browser extension to block requests.
|
||||
Copyright (C) 2014-2015 Raymond Hill
|
||||
uBlock Origin - a browser extension to block requests.
|
||||
Copyright (C) 2014-2016 Raymond Hill
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -19,8 +19,6 @@
|
|||
Home: https://github.com/gorhill/uBlock
|
||||
*/
|
||||
|
||||
/* global µBlock */
|
||||
|
||||
/*******************************************************************************
|
||||
|
||||
A PageRequestStore object is used to store net requests in two ways:
|
||||
|
@ -229,25 +227,23 @@ var frameStoreJunkyardMax = 50;
|
|||
|
||||
/******************************************************************************/
|
||||
|
||||
var FrameStore = function(rootHostname, frameURL) {
|
||||
this.init(rootHostname, frameURL);
|
||||
var FrameStore = function(frameURL) {
|
||||
this.init(frameURL);
|
||||
};
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
FrameStore.factory = function(rootHostname, frameURL) {
|
||||
FrameStore.factory = function(frameURL) {
|
||||
var entry = frameStoreJunkyard.pop();
|
||||
if ( entry === undefined ) {
|
||||
entry = new FrameStore(rootHostname, frameURL);
|
||||
} else {
|
||||
entry.init(rootHostname, frameURL);
|
||||
return new FrameStore(frameURL);
|
||||
}
|
||||
return entry;
|
||||
return entry.init(frameURL);
|
||||
};
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
FrameStore.prototype.init = function(rootHostname, frameURL) {
|
||||
FrameStore.prototype.init = function(frameURL) {
|
||||
var µburi = µb.URI;
|
||||
this.pageHostname = µburi.hostnameFromURI(frameURL);
|
||||
this.pageDomain = µburi.domainFromHostname(this.pageHostname) || this.pageHostname;
|
||||
|
@ -423,9 +419,9 @@ PageStore.prototype.getFrame = function(frameId) {
|
|||
PageStore.prototype.setFrame = function(frameId, frameURL) {
|
||||
var frameStore = this.frames[frameId];
|
||||
if ( frameStore ) {
|
||||
frameStore.init(this.rootHostname, frameURL);
|
||||
frameStore.init(frameURL);
|
||||
} else {
|
||||
this.frames[frameId] = FrameStore.factory(this.rootHostname, frameURL);
|
||||
this.frames[frameId] = FrameStore.factory(frameURL);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue