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

Unified Diff: lib/main.js

Issue 8433028: added hook function to appIntegration to handle function-overwrites from other extensions (Closed)
Patch Set: added missing statement Created Sept. 28, 2012, 9:52 a.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/hooks.js ('k') | lib/rules.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/main.js
===================================================================
--- a/lib/main.js
+++ b/lib/main.js
@@ -76,51 +76,3 @@
require("typedItCollector").onBrowserInitialized(window);
}
-
-var URLFIXER = {
- load : function () {
- document.addEventListener("URLFixerNetErrorCorrection", URLFIXER.netErrorCorrection, false, true);
- },
-
- netErrorCorrection : function (evt) {
- var button = evt.target;
- var oldUrl = button.getAttribute("old");
- var newUrl = button.getAttribute("new");
-
- if (newUrl.indexOf("http://") == -1 && newUrl.indexOf("https://") == -1) {
- newUrl = oldUrl.split("//")[0] + "//" + newUrl;
- }
-
- var rv = newUrl;
-
- var oldParts = oldUrl.split("://");
- var newParts = newUrl.split("://");
-
- // Discard the protocol if they're the same.
- if (oldParts[0] == newParts[0]) {
- oldParts.shift();
- newParts.shift();
- oldUrl = "//" + oldParts.join("//");
- newUrl = "//" + newParts.join("//");
- }
-
- // Ignore www subdomain if both of them have it.
- if (oldUrl.indexOf("//www.") != -1 && (oldUrl.indexOf("//www.") === newUrl.indexOf("//www."))) {
- oldUrl = oldUrl.split("//www.")[1];
- newUrl = newUrl.split("//www.")[1];
- }
-
- // Ignore trailing slashes
- if (oldUrl.charAt(oldUrl.length - 1) == "/" && newUrl.charAt(newUrl.length - 1) == "/") {
- oldUrl = oldUrl.substr(0, oldUrl.length - 1);
- newUrl = newUrl.substr(0, newUrl.length - 1);
- }
-
- var corrections = URLFIXER.getJSONPref("custom_replace", {});
- corrections[oldUrl] = newUrl;
- URLFIXER.setJSONPref("custom_replace", corrections);
-
- content.location.href = rv;
- }
-};
-
« no previous file with comments | « lib/hooks.js ('k') | lib/rules.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld