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

Side by Side Diff: lib/options.js

Issue 29715577: Issue 6449 - Switch to Harmony modules (Closed) Base URL: https://hg.adblockplus.org/adblockpluschrome/
Patch Set: Add lib/.eslintrc.json Created March 6, 2018, 10:30 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
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
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details. 12 * GNU General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU General Public License 14 * You should have received a copy of the GNU General Public License
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
16 */ 16 */
17 17
18 /** @module options */ 18 /** @module options */
19 19
20 "use strict"; 20 import {getDecodedHostname} from "url";
21 21 import {checkWhitelisted} from "whitelisting";
22 const {getDecodedHostname} = require("url"); 22 import {port} from "messaging";
23 const {checkWhitelisted} = require("whitelisting"); 23 import info from "info";
24 const {port} = require("messaging");
25 const info = require("info");
26 24
27 const optionsUrl = "options.html"; 25 const optionsUrl = "options.html";
28 26
29 function findOptionsTab(callback) 27 function findOptionsTab(callback)
30 { 28 {
31 browser.tabs.query({}, tabs => 29 browser.tabs.query({}, tabs =>
32 { 30 {
33 // We find a tab ourselves because Edge has a bug when quering tabs with 31 // We find a tab ourselves because Edge has a bug when quering tabs with
34 // extension URL protocol: 32 // extension URL protocol:
35 // https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/8094 141/ 33 // https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/8094 141/
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 port.off("app.listen", onMessage); 113 port.off("app.listen", onMessage);
116 callback(new ext.Page(tab)); 114 callback(new ext.Page(tab));
117 } 115 }
118 } 116 }
119 117
120 port.on("app.listen", onMessage); 118 port.on("app.listen", onMessage);
121 }); 119 });
122 } 120 }
123 } 121 }
124 122
125 let showOptions =
126 /** 123 /**
127 * Opens the options page. 124 * Opens the options page.
128 * 125 *
129 * @param {function} callback 126 * @param {function} callback
130 */ 127 */
131 exports.showOptions = callback => 128 export const showOptions = callback =>
132 { 129 {
133 findOptionsTab(optionsTab => 130 findOptionsTab(optionsTab =>
134 { 131 {
135 // Edge does not yet support runtime.openOptionsPage (tested version 38) 132 // Edge does not yet support runtime.openOptionsPage (tested version 38)
136 if ("openOptionsPage" in browser.runtime && 133 if ("openOptionsPage" in browser.runtime &&
137 // Some versions of Firefox for Android before version 57 do have a 134 // Some versions of Firefox for Android before version 57 do have a
138 // runtime.openOptionsPage but it doesn't do anything. 135 // runtime.openOptionsPage but it doesn't do anything.
139 // https://bugzilla.mozilla.org/show_bug.cgi?id=1364945 136 // https://bugzilla.mozilla.org/show_bug.cgi?id=1364945
140 (info.application != "fennec" || 137 (info.application != "fennec" ||
141 parseInt(info.applicationVersion, 10) >= 57)) 138 parseInt(info.applicationVersion, 10) >= 57))
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 args: [ 205 args: [
209 { 206 {
210 host: getDecodedHostname(currentPage.url).replace(/^www\./, ""), 207 host: getDecodedHostname(currentPage.url).replace(/^www\./, ""),
211 whitelisted: !!checkWhitelisted(currentPage) 208 whitelisted: !!checkWhitelisted(currentPage)
212 } 209 }
213 ] 210 ]
214 }); 211 });
215 }); 212 });
216 }); 213 });
217 }); 214 });
OLDNEW
« lib/.eslintrc.json ('K') | « lib/notificationHelper.js ('k') | lib/popupBlocker.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld