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

Side by Side Diff: include.preload.js

Issue 5193308200501248: Issue 1287 - Use window.location instead document.location (Closed)
Patch Set: Created Aug. 29, 2014, 3:33 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | safari/ext/content.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <http://adblockplus.org/>, 2 * This file is part of Adblock Plus <http://adblockplus.org/>,
3 * Copyright (C) 2006-2014 Eyeo GmbH 3 * Copyright (C) 2006-2014 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 { 93 {
94 // If URL is already absolute, don't mess with it 94 // If URL is already absolute, don't mess with it
95 if (!url || /^[\w\-]+:/i.test(url)) 95 if (!url || /^[\w\-]+:/i.test(url))
96 return url; 96 return url;
97 97
98 // Leading / means absolute path 98 // Leading / means absolute path
99 // Leading // means network path 99 // Leading // means network path
100 if (url[0] == '/') 100 if (url[0] == '/')
101 { 101 {
102 if (url[1] == '/') 102 if (url[1] == '/')
103 return document.location.protocol + url; 103 return location.protocol + url;
104 else 104 else
105 return document.location.protocol + "//" + document.location.host + url; 105 return location.protocol + "//" + location.host + url;
106 } 106 }
107 107
108 // Remove filename and add relative URL to it 108 // Remove filename and add relative URL to it
109 var base = document.baseURI.match(/.+\//); 109 var base = document.baseURI.match(/.+\//);
110 if (!base) 110 if (!base)
111 return document.baseURI + "/" + url; 111 return document.baseURI + "/" + url;
112 return base[0] + url; 112 return base[0] + url;
113 } 113 }
114 114
115 function init(document) 115 function init(document)
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 }, true); 223 }, true);
224 224
225 ext.backgroundPage.sendMessage({type: "get-selectors"}, setElemhideCSSRules); 225 ext.backgroundPage.sendMessage({type: "get-selectors"}, setElemhideCSSRules);
226 } 226 }
227 227
228 if (document instanceof HTMLDocument) 228 if (document instanceof HTMLDocument)
229 { 229 {
230 checkExceptionKey(); 230 checkExceptionKey();
231 init(document); 231 init(document);
232 } 232 }
OLDNEW
« no previous file with comments | « no previous file | safari/ext/content.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld