2014-12-17 21:33:53 +01:00
|
|
|
/*******************************************************************************
|
|
|
|
|
2016-03-07 01:49:27 +01:00
|
|
|
uBlock Origin - a browser extension to block requests.
|
|
|
|
Copyright (C) 2014-2016 The uBlock Origin authors
|
2014-12-17 21:33:53 +01:00
|
|
|
|
|
|
|
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
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see {http://www.gnu.org/licenses/}.
|
|
|
|
|
|
|
|
Home: https://github.com/gorhill/uBlock
|
|
|
|
*/
|
|
|
|
|
2015-03-12 18:20:48 +01:00
|
|
|
/******************************************************************************/
|
|
|
|
|
2015-09-30 15:33:38 +02:00
|
|
|
// https://developer.mozilla.org/en-US/Firefox/Multiprocess_Firefox/Frame_script_environment
|
2015-03-26 22:00:56 +01:00
|
|
|
|
2016-09-24 20:36:08 +02:00
|
|
|
(function(context) {
|
2016-03-07 01:49:27 +01:00
|
|
|
'use strict';
|
2015-01-11 18:41:52 +01:00
|
|
|
|
2016-09-24 20:36:08 +02:00
|
|
|
if ( !context.docShell ) {
|
2016-04-02 02:53:38 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2016-09-24 20:36:08 +02:00
|
|
|
let webProgress = context.docShell
|
|
|
|
.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
|
|
|
|
.getInterface(Components.interfaces.nsIWebProgress);
|
2016-04-02 02:53:38 +02:00
|
|
|
if ( !webProgress ) {
|
|
|
|
return;
|
|
|
|
}
|
2016-03-29 17:37:19 +02:00
|
|
|
|
|
|
|
// https://github.com/gorhill/uBlock/issues/1514
|
|
|
|
// Fix?
|
2016-04-02 02:53:38 +02:00
|
|
|
let domWindow = webProgress.DOMWindow;
|
|
|
|
if ( domWindow !== domWindow.top ) {
|
|
|
|
return;
|
2015-03-12 18:20:48 +01:00
|
|
|
}
|
2016-04-02 02:53:38 +02:00
|
|
|
|
2016-09-24 20:36:08 +02:00
|
|
|
let {LocationChangeListener} = Components.utils.import(
|
|
|
|
Components.stack.filename.replace('Script', 'Module'),
|
|
|
|
null
|
|
|
|
);
|
|
|
|
|
2016-04-02 02:53:38 +02:00
|
|
|
// https://github.com/gorhill/uBlock/issues/1444
|
|
|
|
// Apparently, on older versions of Firefox (31 and less), the same context
|
2016-09-24 20:36:08 +02:00
|
|
|
// is used for all frame scripts, hence we must use a unique variable name
|
|
|
|
// to ensure no collision.
|
|
|
|
context.ublock0LocationChangeListener = new LocationChangeListener(
|
|
|
|
context.docShell,
|
|
|
|
webProgress
|
|
|
|
);
|
|
|
|
})(this);
|
2015-03-12 18:20:48 +01:00
|
|
|
|
2014-12-17 21:33:53 +01:00
|
|
|
/******************************************************************************/
|