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

Side by Side Diff: composer.postload.js

Issue 29602561: Issue 5817 - Make sure to send initialization message to the Block Element pop-up only after it is … (Closed) Base URL: https://hg.adblockplus.org/adblockpluschrome
Patch Set: Created Nov. 9, 2017, 2:11 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 | lib/filterComposer.js » ('j') | lib/filterComposer.js » ('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 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 if (!currentElement) 386 if (!currentElement)
387 return; 387 return;
388 388
389 let element = currentElement.prisoner || currentElement; 389 let element = currentElement.prisoner || currentElement;
390 getFiltersForElement(element, (filters, selectors) => 390 getFiltersForElement(element, (filters, selectors) =>
391 { 391 {
392 if (currentlyPickingElement) 392 if (currentlyPickingElement)
393 stopPickingElement(); 393 stopPickingElement();
394 394
395 browser.runtime.sendMessage({ 395 browser.runtime.sendMessage({
396 type: "composer.openDialog" 396 type: "composer.openDialog",
397 }, 397 filters
398 popupId => 398 }, popupId =>
399 { 399 {
400 browser.runtime.sendMessage({
401 type: "forward",
402 targetPageId: popupId,
403 payload: {type: "composer.dialog.init", filters}
404 });
405
406 // Only the top frame keeps a record of the popup window's ID, 400 // Only the top frame keeps a record of the popup window's ID,
407 // so if this isn't the top frame we need to pass the ID on. 401 // so if this isn't the top frame we need to pass the ID on.
408 if (window == window.top) 402 if (window == window.top)
409 { 403 {
410 blockelementPopupId = popupId; 404 blockelementPopupId = popupId;
411 } 405 }
412 else 406 else
413 { 407 {
414 browser.runtime.sendMessage({ 408 browser.runtime.sendMessage({
415 type: "forward", 409 type: "forward",
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 if (document instanceof HTMLDocument) 583 if (document instanceof HTMLDocument)
590 { 584 {
591 // There's a bug in Firefox that causes document_end content scripts to run 585 // There's a bug in Firefox that causes document_end content scripts to run
592 // before document_start content scripts on extension startup. In this case 586 // before document_start content scripts on extension startup. In this case
593 // the ext object is undefined, we fail to initialize, and initializeComposer 587 // the ext object is undefined, we fail to initialize, and initializeComposer
594 // returns false. As a workaround, try again after a timeout. 588 // returns false. As a workaround, try again after a timeout.
595 // https://bugzilla.mozilla.org/show_bug.cgi?id=1395287 589 // https://bugzilla.mozilla.org/show_bug.cgi?id=1395287
596 if (!initializeComposer()) 590 if (!initializeComposer())
597 setTimeout(initializeComposer, 2000); 591 setTimeout(initializeComposer, 2000);
598 } 592 }
OLDNEW
« no previous file with comments | « no previous file | lib/filterComposer.js » ('j') | lib/filterComposer.js » ('J')

Powered by Google App Engine
This is Rietveld