Browse Source

Code styling

pull/2/head
Deathamns 10 years ago
committed by gorhill
parent
commit
40b191e9f4
  1. 11
      platform/firefox/frameModule.js

11
platform/firefox/frameModule.js

@ -54,18 +54,22 @@ const contentPolicy = {
contractID: '@' + appName + '/content-policy;1', contractID: '@' + appName + '/content-policy;1',
ACCEPT: Ci.nsIContentPolicy.ACCEPT, ACCEPT: Ci.nsIContentPolicy.ACCEPT,
messageName: appName + ':shouldLoad', messageName: appName + ':shouldLoad',
get componentRegistrar() { get componentRegistrar() {
return Components.manager.QueryInterface(Ci.nsIComponentRegistrar); return Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
}, },
get categoryManager() { get categoryManager() {
return Components.classes['@mozilla.org/categorymanager;1'] return Components.classes['@mozilla.org/categorymanager;1']
.getService(Ci.nsICategoryManager); .getService(Ci.nsICategoryManager);
}, },
QueryInterface: XPCOMUtils.generateQI([ QueryInterface: XPCOMUtils.generateQI([
Ci.nsIFactory, Ci.nsIFactory,
Ci.nsIContentPolicy, Ci.nsIContentPolicy,
Ci.nsISupportsWeakReference Ci.nsISupportsWeakReference
]), ]),
createInstance: function(outer, iid) { createInstance: function(outer, iid) {
if ( outer ) { if ( outer ) {
throw Components.results.NS_ERROR_NO_AGGREGATION; throw Components.results.NS_ERROR_NO_AGGREGATION;
@ -88,6 +92,7 @@ const contentPolicy = {
true true
); );
}, },
unregister: function() { unregister: function() {
this.componentRegistrar.unregisterFactory(this.classID, this); this.componentRegistrar.unregisterFactory(this.classID, this);
this.categoryManager.deleteCategoryEntry( this.categoryManager.deleteCategoryEntry(
@ -96,6 +101,7 @@ const contentPolicy = {
false false
); );
}, },
// https://bugzil.la/612921 // https://bugzil.la/612921
shouldLoad: function(type, location, origin, context) { shouldLoad: function(type, location, origin, context) {
// If we don't know what initiated the request, probably it's not a tab // If we don't know what initiated the request, probably it's not a tab
@ -128,10 +134,12 @@ const contentPolicy = {
const docObserver = { const docObserver = {
contentBaseURI: 'chrome://' + appName + '/content/js/', contentBaseURI: 'chrome://' + appName + '/content/js/',
QueryInterface: XPCOMUtils.generateQI([ QueryInterface: XPCOMUtils.generateQI([
Ci.nsIObserver, Ci.nsIObserver,
Ci.nsISupportsWeakReference Ci.nsISupportsWeakReference
]), ]),
initContext: function(win, sandbox) { initContext: function(win, sandbox) {
let messager = getMessageManager(win); let messager = getMessageManager(win);
@ -164,12 +172,15 @@ const docObserver = {
return win; return win;
}, },
register: function() { register: function() {
Services.obs.addObserver(this, 'document-element-inserted', true); Services.obs.addObserver(this, 'document-element-inserted', true);
}, },
unregister: function() { unregister: function() {
Services.obs.removeObserver(this, 'document-element-inserted'); Services.obs.removeObserver(this, 'document-element-inserted');
}, },
observe: function(doc) { observe: function(doc) {
let win = doc.defaultView; let win = doc.defaultView;

Loading…
Cancel
Save