Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: lib/typoAppIntegration.js

Issue 9251039: Get rid of nested functions declarations that are not on top level (causes strict mode warnings) (Closed)
Patch Set: Created Jan. 23, 2013, 12:52 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/synchronizer.js ('k') | lib/ui.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/typoAppIntegration.js
===================================================================
--- a/lib/typoAppIntegration.js
+++ b/lib/typoAppIntegration.js
@@ -31,39 +31,39 @@ exports.removeFromWindow = function(wind
};
switch (addonName)
{
case "url-fixer":
{
// URL Fixer
exports.isTypoCorrectionEnabled = function(window, prefix, domain, suffix) true;
-
+
break;
}
case "adblockplus":
{
// Adblock Plus
let {Prefs} = require("prefs");
-
+
// Do not ask to opt-in if user found setting
if (!Prefs.correctTyposAsked)
{
let onPrefChange = function(name)
{
if (name == "correctTypos")
{
Prefs.correctTyposAsked = true;
Prefs.removeListener(onPrefChange);
}
}
-
+
Prefs.addListener(onPrefChange);
}
-
+
exports.isTypoCorrectionEnabled = function(window, prefix, domain, suffix)
{
if (!Prefs.correctTyposAsked && !Prefs.correctTypos)
{
let {Utils} = require("utils");
let message = Utils.getString("typo_optin_message").replace(/\?1\?/, domain);
let yes = Utils.getString("typo_optin_yes");
let no = Utils.getString("typo_optin_no");
@@ -87,20 +87,20 @@ switch (addonName)
// No: Do nothing
Prefs.correctTyposAsked = true;
}
}
];
// We need to have persistence being set to 1 due to redirect which happens afterwards
exports.openInfobar(window, "adblockplus-infobar-correct-typos-ask", message, buttons, 1);
}
-
+
return Prefs.correctTypos;
};
-
+
break;
}
}
switch (application)
{
case "firefox":
{
@@ -167,22 +167,22 @@ switch (application)
exports.applyToWindow = function(window, corrector)
{
let urlbar = exports.getURLBar(window);
let goButton = window.document.getElementById("go-button-container");
if (urlbar && urlbar._fireEvent && !functionHooks.has(window))
{
- function correctURL()
+ let correctURL = function()
{
let correction = corrector(window, urlbar.value);
if (correction)
urlbar.value = correction;
- }
+ };
let unhook = hook(urlbar, "_fireEvent", function(eventType)
{
if (eventType == "textentered")
{
correctURL();
}
});
@@ -310,23 +310,23 @@ switch (application)
exports.getBrowser = function(window) null;
exports.applyToWindow = function(window, corrector)
{
if ("BrowserApp" in window && window.BrowserApp.observe && !functionHooks.has(window))
{
let innerUnhook = null;
- function cleanup()
+ let cleanup = function()
{
if (innerUnhook)
innerUnhook();
innerUnhook = null;
- }
+ };
let unhook = hook(window.BrowserApp, "observe", function(subject, topic, data)
{
// Huge hack: we replace addTab/loadURI when the observer is
// triggered. This seems to be the only way to know that the calls
// originate from user input.
let method = null;
if (topic == "Tab:Add")
« no previous file with comments | « lib/synchronizer.js ('k') | lib/ui.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld