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: Created Nov. 4, 2017, 11:22 a.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 // On Firefox we set the popup programmatically here rather than via
128 // manifest.json so we can open the options page directly on Android.
129 if ("getPopup" in browser.browserAction)
kzar 2017/11/04 16:17:26 The idea is that browser.browserAction.getPopup do
Wladimir Palant 2017/11/04 19:43:26 I think that the idea is rather introducing a dela
Manish Jethani 2017/11/05 11:35:00 The idea was that popup.html is set in manifest.js
Manish Jethani 2017/11/05 11:35:00 getPopup does exist on Firefox for Android v57, bu
kzar 2017/11/06 09:36:51 Right gotya.
130 {
131 browser.browserAction.getPopup({}).then(url =>
132 {
133 if (!url && info.application != "fennec")
Manish Jethani 2017/11/04 11:27:17 Note that we can't check for "fennec" in the initi
Wladimir Palant 2017/11/04 19:43:26 Can't we call getBrowserInfo explicitly here then?
kzar 2017/11/04 21:50:31 Oh yea, cool idea. By clearing the popup URL for F
Manish Jethani 2017/11/05 11:35:00 This does not work unfortunately due to a bug that
kzar 2017/11/06 09:36:51 Damn, that sucks. I guess we could at least get ri
Manish Jethani 2017/11/06 14:15:09 Done.
134 browser.browserAction.setPopup({popup: "popup.html"});
135 });
136 }
137
127 // On Firefox for Android, open the options page directly when the browser 138 // On Firefox for Android, open the options page directly when the browser
128 // action is clicked. 139 // action is clicked.
129 browser.browserAction.onClicked.addListener(() => 140 browser.browserAction.onClicked.addListener(() =>
130 { 141 {
131 browser.tabs.query({active: true, lastFocusedWindow: true}, ([tab]) => 142 browser.tabs.query({active: true, lastFocusedWindow: true}, ([tab]) =>
132 { 143 {
133 let currentPage = new ext.Page(tab); 144 let currentPage = new ext.Page(tab);
134 145
135 showOptions(optionsPage => 146 showOptions(optionsPage =>
136 { 147 {
137 if (!/^https?:$/.test(currentPage.url.protocol)) 148 if (!/^https?:$/.test(currentPage.url.protocol))
138 return; 149 return;
139 150
140 optionsPage.sendMessage({ 151 optionsPage.sendMessage({
141 type: "app.respond", 152 type: "app.respond",
142 action: "showPageOptions", 153 action: "showPageOptions",
143 args: [ 154 args: [
144 { 155 {
145 host: getDecodedHostname(currentPage.url).replace(/^www\./, ""), 156 host: getDecodedHostname(currentPage.url).replace(/^www\./, ""),
146 whitelisted: !!checkWhitelisted(currentPage) 157 whitelisted: !!checkWhitelisted(currentPage)
147 } 158 }
148 ] 159 ]
149 }); 160 });
150 }); 161 });
151 }); 162 });
152 }); 163 });
OLDNEW
« no previous file with comments | « no previous file | metadata.gecko » ('j') | metadata.gecko » ('J')

Powered by Google App Engine
This is Rietveld