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

Delta Between Two Patch Sets: safari/ext/common.js

Issue 5464830253203456: Refactored the abstraction layer to address prerendered pages on Safari caused by leaky abstraction (Closed)
Left Patch Set: Fixed issue with element collapsing introduced while rebasing Created April 9, 2014, 6:19 p.m.
Right Patch Set: Addressed comments Created April 11, 2014, 2:47 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « safari/ext/background.js ('k') | safari/ext/content.js » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 if (!placeholderDetails || !placeholderDetails.content) 156 if (!placeholderDetails || !placeholderDetails.content)
157 continue; 157 continue;
158 if (placeholderDetails.content.indexOf("$") != 0) 158 if (placeholderDetails.content.indexOf("$") != 0)
159 continue; 159 continue;
160 160
161 var placeholderIdx = parseInt(placeholderDetails.content.substr(1)); 161 var placeholderIdx = parseInt(placeholderDetails.content.substr(1));
162 if (isNaN(placeholderIdx) || placeholderIdx < 1) 162 if (isNaN(placeholderIdx) || placeholderIdx < 1)
163 continue; 163 continue;
164 164
165 var placeholderValue; 165 var placeholderValue;
166 if (substitutions && substitutions.constructor == Array) 166 if (typeof substitutions != "string")
Wladimir Palant 2014/04/11 13:02:35 Please remind me, why can't this be simply |substi
Sebastian Noack 2014/04/11 14:47:45 When I wrote the original code I followed the top
Wladimir Palant 2014/04/11 18:31:19 The only case where instanceof Array is problemati
167 placeholderValue = substitutions[placeholderIdx - 1]; 167 placeholderValue = substitutions[placeholderIdx - 1];
168 else if (placeholderIdx == 1) 168 else if (placeholderIdx == 1)
169 placeholderValue = substitutions; 169 placeholderValue = substitutions;
170 170
171 msgstr = msgstr.replace("$" + placeholder + "$", placeholderValue || " "); 171 msgstr = msgstr.replace("$" + placeholder + "$", placeholderValue || " ");
172 } 172 }
173 173
174 return msgstr; 174 return msgstr;
175 } 175 }
176 176
177 return ""; 177 return "";
178 } 178 }
179 }; 179 };
180 180
181 181
182 /* Utils */ 182 /* Utils */
183 183
184 ext.getURL = function(path) 184 ext.getURL = function(path)
185 { 185 {
186 return safari.extension.baseURI + path; 186 return safari.extension.baseURI + path;
187 }; 187 };
188 })(); 188 })();
LEFTRIGHT

Powered by Google App Engine
This is Rietveld