Firefox: simplify vAPI.app.restart

pull/2/head
Deathamns 10 years ago committed by gorhill
parent 6571a0700f
commit f570bc7f48

@ -19,20 +19,17 @@
Home: https://github.com/gorhill/uBlock Home: https://github.com/gorhill/uBlock
*/ */
/* global Services, Components, XPCOMUtils, __URI__ */
'use strict'; 'use strict';
/******************************************************************************/ /******************************************************************************/
this.EXPORTED_SYMBOLS = ['contentObserver']; this.EXPORTED_SYMBOLS = ['contentObserver'];
const {interfaces: Ci, utils: Cu} = Components; const {interfaces: Ci, utils: Cu} = this.Components;
const appName = __URI__.match(/:\/\/([^\/]+)/)[1]; const appName = this.__URI__.match(/:\/\/([^\/]+)/)[1];
Cu['import']('resource://gre/modules/Services.jsm'); Cu.import('resource://gre/modules/Services.jsm');
Cu['import']('resource://gre/modules/XPCOMUtils.jsm'); Cu.import('resource://gre/modules/devtools/Console.jsm');
// Cu['import']('resource://gre/modules/devtools/Console.jsm');
/******************************************************************************/ /******************************************************************************/
@ -66,12 +63,16 @@ const contentObserver = {
.getService(Ci.nsICategoryManager); .getService(Ci.nsICategoryManager);
}, },
QueryInterface: XPCOMUtils.generateQI([ QueryInterface: (function() {
let {XPCOMUtils} = Cu['import']('resource://gre/modules/XPCOMUtils.jsm', {});
return XPCOMUtils.generateQI([
Ci.nsIFactory, Ci.nsIFactory,
Ci.nsIObserver, Ci.nsIObserver,
Ci.nsIContentPolicy, Ci.nsIContentPolicy,
Ci.nsISupportsWeakReference Ci.nsISupportsWeakReference
]), ]);
})(),
createInstance: function(outer, iid) { createInstance: function(outer, iid) {
if ( outer ) { if ( outer ) {
@ -117,7 +118,7 @@ const contentObserver = {
return this.ACCEPT; return this.ACCEPT;
} }
let opener; var opener;
if ( location.scheme !== 'http' && location.scheme !== 'https' ) { if ( location.scheme !== 'http' && location.scheme !== 'https' ) {
if ( type !== this.MAIN_FRAME ) { if ( type !== this.MAIN_FRAME ) {
@ -208,6 +209,7 @@ const contentObserver = {
this.initContentScripts(win); this.initContentScripts(win);
} }
// What about data: and about:blank?
return; return;
} }

Loading…
Cancel
Save