1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-07-08 12:57:57 +02:00

Firefox/Fennec fixes

This commit is contained in:
Deathamns 2015-03-01 20:21:05 +01:00
parent 092bfbd274
commit da3586adde
3 changed files with 22 additions and 9 deletions

View File

@ -53,7 +53,6 @@ const contentObserver = {
MAIN_FRAME: Ci.nsIContentPolicy.TYPE_DOCUMENT,
contentBaseURI: 'chrome://' + hostName + '/content/js/',
cpMessageName: hostName + ':shouldLoad',
ignoredPopups: new WeakMap(),
uniqueSandboxId: 1,

View File

@ -364,10 +364,15 @@ var tabWatcher = {
return;
}
var loc = win.location;
/*if ( loc.protocol === 'http' || loc.protocol === 'https' ) {
return;
}*/
vAPI.tabs.onNavigation({
frameId: 0,
tabId: getOwnerWindow(win).getTabForWindow(win).id,
url: Services.io.newURI(win.location.href, null, null).asciiSpec
tabId: getOwnerWindow(win).BrowserApp.getTabForWindow(win).id,
url: Services.io.newURI(loc.href, null, null).asciiSpec
});
}
};
@ -464,7 +469,7 @@ vAPI.tabs.registerListeners = function() {
}
var URI = browser.currentURI;
if ( URI.schemeIs('chrome') && URI.host === location.host ) {
vAPI.tabs._remove(tab, win);
vAPI.tabs._remove(tab, getTabBrowser(win));
}
}
}
@ -482,7 +487,7 @@ vAPI.tabs.getTabId = function(target) {
for ( var win of this.getWindows() ) {
var tab = win.BrowserApp.getTabForBrowser(target);
if ( tab && tab.id ) {
if ( tab && tab.id !== undefined ) {
return tab.id;
}
}
@ -1023,6 +1028,7 @@ var httpObserver = {
classDescription: 'net-channel-event-sinks for ' + location.host,
classID: Components.ID('{dc8d6319-5f6e-4438-999e-53722db99e84}'),
contractID: '@' + location.host + '/net-channel-event-sinks;1',
REQDATAKEY: location.host + 'reqdata',
ABORT: Components.results.NS_BINDING_ABORTED,
ACCEPT: Components.results.NS_SUCCEEDED,
// Request types: https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIContentPolicy#Constants
@ -1185,7 +1191,7 @@ var httpObserver = {
frameId,
parentFrameId
]*/
channelData = channel.getProperty(location.host + 'reqdata');
channelData = channel.getProperty(this.REQDATAKEY);
} catch (ex) {
return;
}
@ -1272,10 +1278,18 @@ var httpObserver = {
return;
}
/*if ( vAPI.fennec && lastRequest.type === this.MAIN_FRAME ) {
vAPI.tabs.onNavigation({
frameId: 0,
tabId: lastRequest.tabId,
url: URI.asciiSpec
});
}*/
// If request is not handled we may use the data in on-modify-request
if ( channel instanceof Ci.nsIWritablePropertyBag ) {
channel.setProperty(
location.host + 'reqdata',
this.REQDATAKEY,
[
lastRequest.type,
lastRequest.tabId,
@ -1735,7 +1749,7 @@ vAPI.contextMenu.create = function(details, callback) {
if ( gContextMenu.inFrame ) {
details.tagName = 'iframe';
// Probably won't work with e01s
// Probably won't work with e10s
details.frameUrl = gContextMenu.focusedWindow.location.href;
} else if ( gContextMenu.onImage ) {
details.tagName = 'img';

View File

@ -47,7 +47,7 @@ vAPI.tabs.onNavigation = function(details) {
// The hostname of the bound document must always be present in the
// mini-matrix. That's the best place I could find for the fix, all other
// options had bad side-effects or complications.
// TODO: Evantually, we will have to use an API to check whether a scheme
// TODO: Evantually, we will have to use an API to check whether a scheme
// is supported as I suspect we are going to start to see `ws`, `wss`
// as well soon.
if ( pageStore && details.url.lastIndexOf('http', 0) === 0 ) {