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

Side by Side Diff: lib/filterComposer.js

Issue 29713631: Issue 5760 - Use relative require paths (Closed)
Patch Set: Address PS3 comment Created April 3, 2018, 6:03 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
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 filterComposer */ 18 /** @module filterComposer */
19 19
20 "use strict"; 20 "use strict";
21 21
22 const {defaultMatcher} = require("matcher"); 22 const {defaultMatcher} = require("../adblockpluscore/lib/matcher");
23 const {RegExpFilter} = require("filterClasses"); 23 const {RegExpFilter} = require("../adblockpluscore/lib/filterClasses");
24 const {FilterNotifier} = require("filterNotifier"); 24 const {FilterNotifier} = require("../adblockpluscore/lib/filterNotifier");
25 const {Prefs} = require("prefs"); 25 const {Prefs} = require("./prefs");
26 const {extractHostFromFrame, stringifyURL, isThirdParty} = require("url"); 26 const {extractHostFromFrame, stringifyURL, isThirdParty} = require("./url");
27 const {getKey, checkWhitelisted} = require("whitelisting"); 27 const {getKey, checkWhitelisted} = require("./whitelisting");
28 const {port} = require("messaging"); 28 const {port} = require("./messaging");
29 const info = require("info"); 29 const info = require("../buildtools/info");
30 30
31 let readyPages = new ext.PageMap(); 31 let readyPages = new ext.PageMap();
32 32
33 /** 33 /**
34 * Checks whether the given page is ready to use the filter composer 34 * Checks whether the given page is ready to use the filter composer
35 * 35 *
36 * @param {Page} page 36 * @param {Page} page
37 * @return {boolean} 37 * @return {boolean}
38 */ 38 */
39 exports.isPageReady = page => 39 exports.isPageReady = page =>
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 { 280 {
281 sender.page.sendMessage({ 281 sender.page.sendMessage({
282 type: "composer.content.dialogClosed", 282 type: "composer.content.dialogClosed",
283 popupId: popupPageId 283 popupId: popupPageId
284 }); 284 });
285 browser.tabs.onRemoved.removeListener(onRemoved); 285 browser.tabs.onRemoved.removeListener(onRemoved);
286 } 286 }
287 }; 287 };
288 browser.tabs.onRemoved.addListener(onRemoved); 288 browser.tabs.onRemoved.addListener(onRemoved);
289 289
290 if (require("info").application == "firefox" && 290 if (info.application == "firefox" &&
kzar 2018/04/05 11:14:56 Nit: Wouldn't this condition fit on one line now?
Jon Sonesen 2018/04/05 23:01:20 Acknowledged.
291 navigator.oscpu.startsWith("Linux")) 291 navigator.oscpu.startsWith("Linux"))
292 { 292 {
293 // Work around https://bugzil.la/1408446 293 // Work around https://bugzil.la/1408446
294 browser.windows.update(window.id, {width: window.width + 1}); 294 browser.windows.update(window.id, {width: window.width + 1});
295 } 295 }
296 return popupPageId; 296 return popupPageId;
297 }); 297 });
298 }); 298 });
299 299
300 port.on("composer.getFilters", (message, sender) => 300 port.on("composer.getFilters", (message, sender) =>
(...skipping 22 matching lines...) Expand all
323 // When tabs start loading we send them a message to ensure that the state 323 // When tabs start loading we send them a message to ensure that the state
324 // of the "block element" tool is reset. This is necessary since Firefox will 324 // of the "block element" tool is reset. This is necessary since Firefox will
325 // sometimes cache the state of a tab when the user navigates back / forward, 325 // sometimes cache the state of a tab when the user navigates back / forward,
326 // which includes the state of the "block element" tool. 326 // which includes the state of the "block element" tool.
327 // Since sending this message will often fail (e.g. for new tabs which have 327 // Since sending this message will often fail (e.g. for new tabs which have
328 // just been opened) we catch and ignore any exception thrown. 328 // just been opened) we catch and ignore any exception thrown.
329 browser.tabs.sendMessage( 329 browser.tabs.sendMessage(
330 page.id, {type: "composer.content.finished"} 330 page.id, {type: "composer.content.finished"}
331 ).catch(() => {}); 331 ).catch(() => {});
332 }); 332 });
OLDNEW

Powered by Google App Engine
This is Rietveld