Code cleanup.

This commit is contained in:
kkapsner 2016-02-13 12:48:22 +01:00
parent 951277e922
commit 6ce7b81124
7 changed files with 10 additions and 38 deletions

View File

@ -49,6 +49,7 @@
if (url.href === "about:blank"){ if (url.href === "about:blank"){
break; break;
} }
return "allow";
case "chrome:": case "chrome:":
return "allow"; return "allow";
} }

View File

@ -1,3 +1,4 @@
/* jslint moz: true */
/* This Source Code Form is subject to the terms of the Mozilla Public /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
@ -47,5 +48,5 @@
} }
); );
}); });
} };
}()); }());

View File

@ -1,3 +1,4 @@
/* jslint moz: true */
/* This Source Code Form is subject to the terms of the Mozilla Public /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
@ -70,17 +71,18 @@ Object.keys(lists).forEach(function(type){
}); });
function updateStackList(){ function updateStackList(){
var list;
try { try {
var data = JSON.parse(prefs.stackList); var data = JSON.parse(prefs.stackList);
if (!Array.isArray(data)){ if (!Array.isArray(data)){
data = [data]; data = [data];
} }
var list = data.filter(function(entry){ list = data.filter(function(entry){
return typeof entry === "object" && typeof entry.url === "string"; return typeof entry === "object" && typeof entry.url === "string";
}); });
} }
catch(e){ catch(e){
var list = []; list = [];
} }
list.match = function(stack){ list.match = function(stack){
return this.some(function(stackRule){ return this.some(function(stackRule){

View File

@ -27,39 +27,6 @@
} }
}; };
// const observers = require("sdk/system/events");
// const {intercept} = require("./intercept");
// const {errorToCallingStack} = require("./callingStack.js");
// const {ask} = require("./askForPermission");
// function interceptWrapper(ev){
// intercept(ev, {
// check,
// ask: function(data){
// return ask(
// data,
// {
// _,
// prefs: function(name){
// return prefs[ev.data];
// }
// }
// );
// },
// notify: function(data, window){
// notify(
// data,
// {
// lists, _, notificationPref, window
// }
// );
// }
// });
// }
// observers.on("content-document-global-created", interceptWrapper);
// unload(function(){
// observers.off("content-document-global-created", interceptWrapper);
// });
const {Cc, Ci} = require("chrome"); const {Cc, Ci} = require("chrome");
var globalMM = Cc["@mozilla.org/globalmessagemanager;1"].getService(Ci.nsIMessageListenerManager); var globalMM = Cc["@mozilla.org/globalmessagemanager;1"].getService(Ci.nsIMessageListenerManager);
var frameURL = require("sdk/self").data.url("frame.js?" + Math.random()); var frameURL = require("sdk/self").data.url("frame.js?" + Math.random());

View File

@ -27,7 +27,7 @@
source source
); );
} }
var data = imageData.data; data = imageData.data;
for (var i = 0, l = data.length; i < l; i += 1){ for (var i = 0, l = data.length; i < l; i += 1){
var value = source[i]; var value = source[i];

View File

@ -1,3 +1,4 @@
/* jslint moz: true */
/* This Source Code Form is subject to the terms of the Mozilla Public /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
@ -13,7 +14,7 @@ exports.notify = function({url, errorStack}, {lists, notificationPref, _, browse
var contentURL = new URL(url); var contentURL = new URL(url);
if (notificationPref.doShow() && !lists.get("ignore").match(contentURL)){ if (notificationPref.doShow() && !lists.get("ignore").match(contentURL)){
var url = contentURL.href; url = contentURL.href;
var domain = contentURL.hostname; var domain = contentURL.hostname;
var message = _("fakedReadout").replace(/\{url\}/g, domain || url); var message = _("fakedReadout").replace(/\{url\}/g, domain || url);