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

Loading…
Cancel
Save