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

Delta Between Two Patch Sets: lib/options.js

Issue 29782593: Noissue - Don't hard-code options and popup URL (Closed)
Left Patch Set: Add default_popup on Firefox Created May 15, 2018, 2:14 p.m.
Right Patch Set: Use "" instead of null for compatiblity with older Firefox versions Created May 15, 2018, 2:19 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 | « no previous file | metadata.gecko » ('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 <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-present eyeo GmbH 3 * Copyright (C) 2006-present 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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 // options page to open instead of the bubble. Unfortunately there's a bug[1] 181 // options page to open instead of the bubble. Unfortunately there's a bug[1]
182 // which prevents us from doing that, so we must avoid setting the URL on 182 // which prevents us from doing that, so we must avoid setting the URL on
183 // Firefox from the manifest at all, instead setting it here only for 183 // Firefox from the manifest at all, instead setting it here only for
184 // non-mobile. 184 // non-mobile.
185 // [1] - https://bugzilla.mozilla.org/show_bug.cgi?id=1414613 185 // [1] - https://bugzilla.mozilla.org/show_bug.cgi?id=1414613
186 if ("getBrowserInfo" in browser.runtime) 186 if ("getBrowserInfo" in browser.runtime)
187 { 187 {
188 browser.runtime.getBrowserInfo().then(browserInfo => 188 browser.runtime.getBrowserInfo().then(browserInfo =>
189 { 189 {
190 if (browserInfo.name == "Fennec") 190 if (browserInfo.name == "Fennec")
191 browser.browserAction.setPopup({popup: null}); 191 browser.browserAction.setPopup({popup: ""});
192 }); 192 });
193 } 193 }
194 194
195 // On Firefox for Android, open the options page directly when the browser 195 // On Firefox for Android, open the options page directly when the browser
196 // action is clicked. 196 // action is clicked.
197 browser.browserAction.onClicked.addListener(() => 197 browser.browserAction.onClicked.addListener(() =>
198 { 198 {
199 browser.tabs.query({active: true, lastFocusedWindow: true}, ([tab]) => 199 browser.tabs.query({active: true, lastFocusedWindow: true}, ([tab]) =>
200 { 200 {
201 let currentPage = new ext.Page(tab); 201 let currentPage = new ext.Page(tab);
202 202
203 showOptions((optionsPage, port) => 203 showOptions((optionsPage, port) =>
204 { 204 {
205 if (!/^https?:$/.test(currentPage.url.protocol)) 205 if (!/^https?:$/.test(currentPage.url.protocol))
206 return; 206 return;
207 207
208 port.postMessage({ 208 port.postMessage({
209 type: "app.respond", 209 type: "app.respond",
210 action: "showPageOptions", 210 action: "showPageOptions",
211 args: [ 211 args: [
212 { 212 {
213 host: currentPage.url.hostname.replace(/^www\./, ""), 213 host: currentPage.url.hostname.replace(/^www\./, ""),
214 whitelisted: !!checkWhitelisted(currentPage) 214 whitelisted: !!checkWhitelisted(currentPage)
215 } 215 }
216 ] 216 ]
217 }); 217 });
218 }); 218 });
219 }); 219 });
220 }); 220 });
LEFTRIGHT
« no previous file | metadata.gecko » ('j') | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld