mirror of https://github.com/gorhill/uBlock.git
Firefox: minimal effort to support older versions
This commit is contained in:
parent
f6e996c25a
commit
48134d9469
|
@ -153,13 +153,24 @@ const contentObserver = {
|
||||||
// so check context.top instead of context
|
// so check context.top instead of context
|
||||||
if ( context.top && context.location ) {
|
if ( context.top && context.location ) {
|
||||||
// https://bugzil.la/1092216
|
// https://bugzil.la/1092216
|
||||||
getMessageManager(context).sendRpcMessage(this.cpMessageName, {
|
let messageManager = getMessageManager(context);
|
||||||
|
let details = {
|
||||||
openerURL: openerURL || null,
|
openerURL: openerURL || null,
|
||||||
url: location.spec,
|
url: location.spec,
|
||||||
type: type,
|
type: type,
|
||||||
frameId: type === this.MAIN_FRAME ? -1 : (context === context.top ? 0 : 1),
|
frameId: type === this.MAIN_FRAME ? -1 : (context === context.top ? 0 : 1),
|
||||||
parentFrameId: context === context.top ? -1 : 0
|
parentFrameId: context === context.top ? -1 : 0
|
||||||
});
|
};
|
||||||
|
|
||||||
|
// TODO: frameId from outerWindowID?
|
||||||
|
// https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIDOMWindowUtils
|
||||||
|
|
||||||
|
if ( typeof messageManager.sendRpcMessage === 'function' ) {
|
||||||
|
messageManager.sendRpcMessage(this.cpMessageName, details);
|
||||||
|
} else {
|
||||||
|
// Compatibility for older versions
|
||||||
|
messageManager.sendSyncMessage(this.cpMessageName, details);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.ACCEPT;
|
return this.ACCEPT;
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
<targetApplication>
|
<targetApplication>
|
||||||
<r:Description>
|
<r:Description>
|
||||||
<id>{{ec8030f7-c20a-464f-9b0e-13a3a9e97384}}</id>
|
<id>{{ec8030f7-c20a-464f-9b0e-13a3a9e97384}}</id>
|
||||||
<minVersion>29.0</minVersion>
|
<minVersion>24.0</minVersion>
|
||||||
<maxVersion>38.0</maxVersion>
|
<maxVersion>38.0</maxVersion>
|
||||||
</r:Description>
|
</r:Description>
|
||||||
</targetApplication>
|
</targetApplication>
|
||||||
|
@ -26,7 +26,7 @@
|
||||||
<targetApplication>
|
<targetApplication>
|
||||||
<r:Description>
|
<r:Description>
|
||||||
<id>{{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}}</id>
|
<id>{{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}}</id>
|
||||||
<minVersion>2.26</minVersion>
|
<minVersion>2.21</minVersion>
|
||||||
<maxVersion>2.35</maxVersion>
|
<maxVersion>2.35</maxVersion>
|
||||||
</r:Description>
|
</r:Description>
|
||||||
</targetApplication>
|
</targetApplication>
|
||||||
|
|
|
@ -45,7 +45,7 @@ vAPI.firefox = true;
|
||||||
// TODO: read these data from somewhere...
|
// TODO: read these data from somewhere...
|
||||||
vAPI.app = {
|
vAPI.app = {
|
||||||
name: 'µBlock',
|
name: 'µBlock',
|
||||||
version: '0.8.5.3'
|
version: '0.8.5.4'
|
||||||
};
|
};
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
@ -366,7 +366,7 @@ vAPI.tabs.registerListeners = function() {
|
||||||
|
|
||||||
vAPI.tabs.getTabId = function(target) {
|
vAPI.tabs.getTabId = function(target) {
|
||||||
if ( target.linkedPanel ) {
|
if ( target.linkedPanel ) {
|
||||||
return target.linkedPanel.slice(6);
|
return target.linkedPanel;
|
||||||
}
|
}
|
||||||
|
|
||||||
var i, gBrowser = target.ownerDocument.defaultView.gBrowser;
|
var i, gBrowser = target.ownerDocument.defaultView.gBrowser;
|
||||||
|
@ -374,13 +374,13 @@ vAPI.tabs.getTabId = function(target) {
|
||||||
// This should be more efficient from version 35
|
// This should be more efficient from version 35
|
||||||
if ( gBrowser.getTabForBrowser ) {
|
if ( gBrowser.getTabForBrowser ) {
|
||||||
i = gBrowser.getTabForBrowser(target);
|
i = gBrowser.getTabForBrowser(target);
|
||||||
return i ? i.linkedPanel.slice(6) : -1;
|
return i ? i.linkedPanel : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
i = gBrowser.browsers.indexOf(target);
|
i = gBrowser.browsers.indexOf(target);
|
||||||
|
|
||||||
if ( i !== -1 ) {
|
if ( i !== -1 ) {
|
||||||
i = gBrowser.tabs[i].linkedPanel.slice(6);
|
i = gBrowser.tabs[i].linkedPanel;
|
||||||
}
|
}
|
||||||
|
|
||||||
return i;
|
return i;
|
||||||
|
@ -399,7 +399,7 @@ vAPI.tabs.get = function(tabId, callback) {
|
||||||
|
|
||||||
for ( var win of windows ) {
|
for ( var win of windows ) {
|
||||||
tab = win.gBrowser.tabContainer.querySelector(
|
tab = win.gBrowser.tabContainer.querySelector(
|
||||||
'tab[linkedpanel="panel-' + tabId + '"]'
|
'tab[linkedpanel="' + tabId + '"]'
|
||||||
);
|
);
|
||||||
|
|
||||||
if ( tab ) {
|
if ( tab ) {
|
||||||
|
@ -541,7 +541,7 @@ vAPI.tabs.remove = function(tabIds) {
|
||||||
}
|
}
|
||||||
|
|
||||||
tabIds = tabIds.map(function(tabId) {
|
tabIds = tabIds.map(function(tabId) {
|
||||||
return 'tab[linkedpanel="panel-' + tabId + '"]';
|
return 'tab[linkedpanel="' + tabId + '"]';
|
||||||
}).join(',');
|
}).join(',');
|
||||||
|
|
||||||
for ( var win of this.getWindows() ) {
|
for ( var win of this.getWindows() ) {
|
||||||
|
@ -580,6 +580,7 @@ vAPI.tabs.injectScript = function(tabId, details, callback) {
|
||||||
details.file = vAPI.getURL(details.file);
|
details.file = vAPI.getURL(details.file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
tab.linkedBrowser.messageManager.sendAsyncMessage(
|
tab.linkedBrowser.messageManager.sendAsyncMessage(
|
||||||
location.host + ':broadcast',
|
location.host + ':broadcast',
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
|
@ -1135,7 +1136,12 @@ vAPI.toolbarButton = {
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
vAPI.toolbarButton.init = function() {
|
vAPI.toolbarButton.init = function() {
|
||||||
|
try {
|
||||||
var {CustomizableUI} = Cu.import('resource:///modules/CustomizableUI.jsm', null);
|
var {CustomizableUI} = Cu.import('resource:///modules/CustomizableUI.jsm', null);
|
||||||
|
} catch (ex) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.defaultArea = CustomizableUI.AREA_NAVBAR;
|
this.defaultArea = CustomizableUI.AREA_NAVBAR;
|
||||||
this.styleURI = [
|
this.styleURI = [
|
||||||
'#' + this.id + ' {',
|
'#' + this.id + ' {',
|
||||||
|
|
|
@ -65,4 +65,5 @@ iframe {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
border-top: 50px solid transparent;
|
border-top: 50px solid transparent;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
-moz-box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
body {
|
body {
|
||||||
border: 0;
|
border: 0;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
-moz-box-sizing: border-box;
|
||||||
font: 12px monospace;
|
font: 12px monospace;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
|
|
|
@ -8,6 +8,7 @@ body {
|
||||||
background-color: #eee;
|
background-color: #eee;
|
||||||
border: none;
|
border: none;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
-moz-box-sizing: border-box;
|
||||||
height: 4em;
|
height: 4em;
|
||||||
padding: 1em;
|
padding: 1em;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
|
@ -41,6 +42,7 @@ select option {
|
||||||
#content {
|
#content {
|
||||||
border: 0;
|
border: 0;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
-moz-box-sizing: border-box;
|
||||||
height: calc(100vh - 4em);
|
height: calc(100vh - 4em);
|
||||||
margin-top: 4em;
|
margin-top: 4em;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
|
|
|
@ -192,6 +192,7 @@ body.dirty #refresh:hover {
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
border: none;
|
border: none;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
-moz-box-sizing: border-box;
|
||||||
color: #000;
|
color: #000;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
height: 24px;
|
height: 24px;
|
||||||
|
|
Loading…
Reference in New Issue