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

Side by Side Diff: lib/options.js

Issue 29597555: Issue 5977 - Set popup programmatically on Firefox (Closed) Base URL: https://hg.adblockplus.org/adblockpluschrome/
Patch Set: Revert changes to polyfill.js Created Nov. 6, 2017, 2:16 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 | metadata.gecko » ('j') | metadata.gecko » ('J')
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 <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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 // We use a relative URL here because of this Edge issue: 117 // We use a relative URL here because of this Edge issue:
118 // https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/10 276332 118 // https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/10 276332
119 browser.tabs.create({url: optionsUrl}, () => 119 browser.tabs.create({url: optionsUrl}, () =>
120 { 120 {
121 returnShowOptionsCall(optionsTab, callback); 121 returnShowOptionsCall(optionsTab, callback);
122 }); 122 });
123 } 123 }
124 }); 124 });
125 }; 125 };
126 126
127 // We need to clear the popup URL on Firefox for Android in order for the
128 // options page to open instead of the bubble. Unfortunately there's a bug[1]
129 // which prevents us from doing that, so we must avoid setting the URL on
130 // Firefox from the manifest at all, instead setting it here only for
131 // non-mobile.
132 // [1] - https://bugzilla.mozilla.org/show_bug.cgi?id=1414613
133 if (info.application == "firefox")
134 {
135 browser.browserAction.setPopup({popup: "popup.html"});
136 }
137 else if (info.platform == "gecko")
138 {
139 browser.runtime.getBrowserInfo().then(browserInfo =>
140 {
141 if (browserInfo.name != "Fennec")
142 browser.browserAction.setPopup({popup: "popup.html"});
143 });
144 }
Wladimir Palant 2017/11/06 15:04:31 If we are choosing that approach, I wonder whether
Manish Jethani 2017/11/13 10:42:13 I was hoping to restrict this to Gecko only to avo
145
127 // On Firefox for Android, open the options page directly when the browser 146 // On Firefox for Android, open the options page directly when the browser
128 // action is clicked. 147 // action is clicked.
129 browser.browserAction.onClicked.addListener(() => 148 browser.browserAction.onClicked.addListener(() =>
130 { 149 {
131 browser.tabs.query({active: true, lastFocusedWindow: true}, ([tab]) => 150 browser.tabs.query({active: true, lastFocusedWindow: true}, ([tab]) =>
132 { 151 {
133 let currentPage = new ext.Page(tab); 152 let currentPage = new ext.Page(tab);
134 153
135 showOptions(optionsPage => 154 showOptions(optionsPage =>
136 { 155 {
137 if (!/^https?:$/.test(currentPage.url.protocol)) 156 if (!/^https?:$/.test(currentPage.url.protocol))
138 return; 157 return;
139 158
140 optionsPage.sendMessage({ 159 optionsPage.sendMessage({
141 type: "app.respond", 160 type: "app.respond",
142 action: "showPageOptions", 161 action: "showPageOptions",
143 args: [ 162 args: [
144 { 163 {
145 host: getDecodedHostname(currentPage.url).replace(/^www\./, ""), 164 host: getDecodedHostname(currentPage.url).replace(/^www\./, ""),
146 whitelisted: !!checkWhitelisted(currentPage) 165 whitelisted: !!checkWhitelisted(currentPage)
147 } 166 }
148 ] 167 ]
149 }); 168 });
150 }); 169 });
151 }); 170 });
152 }); 171 });
OLDNEW
« no previous file with comments | « no previous file | metadata.gecko » ('j') | metadata.gecko » ('J')

Powered by Google App Engine
This is Rietveld