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

Side by Side Diff: composer.postload.js

Issue 29753563: Noissue - Renamed "forward" message to "composer.forward" (Closed)
Patch Set: Changed message name in composer.js Created April 16, 2018, 11:43 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 | « composer.js ('k') | lib/filterComposer.js » ('j') | no next file with comments »
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 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 { 399 {
400 // 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,
401 // 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.
402 if (window == window.top) 402 if (window == window.top)
403 { 403 {
404 blockelementPopupId = popupId; 404 blockelementPopupId = popupId;
405 } 405 }
406 else 406 else
407 { 407 {
408 browser.runtime.sendMessage({ 408 browser.runtime.sendMessage({
409 type: "forward", 409 type: "composer.forward",
410 payload: {type: "composer.content.dialogOpened", popupId} 410 payload: {type: "composer.content.dialogOpened", popupId}
411 }); 411 });
412 } 412 }
413 }); 413 });
414 414
415 if (selectors.length > 0) 415 if (selectors.length > 0)
416 highlightElements(selectors.join(",")); 416 highlightElements(selectors.join(","));
417 417
418 highlightElement(currentElement, "#fd1708", "#f6a1b5"); 418 highlightElement(currentElement, "#fd1708", "#f6a1b5");
419 }); 419 });
(...skipping 22 matching lines...) Expand all
442 442
443 // We're done with the block element feature for now, tidy everything up. 443 // We're done with the block element feature for now, tidy everything up.
444 function deactivateBlockElement(popupAlreadyClosed) 444 function deactivateBlockElement(popupAlreadyClosed)
445 { 445 {
446 if (currentlyPickingElement) 446 if (currentlyPickingElement)
447 stopPickingElement(); 447 stopPickingElement();
448 448
449 if (blockelementPopupId != null && !popupAlreadyClosed) 449 if (blockelementPopupId != null && !popupAlreadyClosed)
450 { 450 {
451 browser.runtime.sendMessage({ 451 browser.runtime.sendMessage({
452 type: "forward", 452 type: "composer.forward",
453 targetPageId: blockelementPopupId, 453 targetPageId: blockelementPopupId,
454 payload: 454 payload:
455 { 455 {
456 type: "composer.dialog.close" 456 type: "composer.dialog.close"
457 } 457 }
458 }); 458 });
459 } 459 }
460 460
461 blockelementPopupId = null; 461 blockelementPopupId = null;
462 lastRightClickEvent = null; 462 lastRightClickEvent = null;
(...skipping 23 matching lines...) Expand all
486 // element. 486 // element.
487 // We also need to make sure that the previous right click event, 487 // We also need to make sure that the previous right click event,
488 // if there is one, is removed. We don't know which frame it is in so we must 488 // if there is one, is removed. We don't know which frame it is in so we must
489 // send a message to the other frames to clear their old right click events. 489 // send a message to the other frames to clear their old right click events.
490 document.addEventListener("contextmenu", event => 490 document.addEventListener("contextmenu", event =>
491 { 491 {
492 lastRightClickEvent = event; 492 lastRightClickEvent = event;
493 lastRightClickEventIsMostRecent = true; 493 lastRightClickEventIsMostRecent = true;
494 494
495 browser.runtime.sendMessage({ 495 browser.runtime.sendMessage({
496 type: "forward", 496 type: "composer.forward",
497 payload: 497 payload:
498 { 498 {
499 type: "composer.content.clearPreviousRightClickEvent" 499 type: "composer.content.clearPreviousRightClickEvent"
500 } 500 }
501 }); 501 });
502 }, true); 502 }, true);
503 503
504 ext.onMessage.addListener((message, sender, sendResponse) => 504 ext.onMessage.addListener((message, sender, sendResponse) =>
505 { 505 {
506 switch (message.type) 506 switch (message.type)
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 case "composer.content.dialogOpened": 555 case "composer.content.dialogOpened":
556 if (window == window.top) 556 if (window == window.top)
557 blockelementPopupId = message.popupId; 557 blockelementPopupId = message.popupId;
558 break; 558 break;
559 case "composer.content.dialogClosed": 559 case "composer.content.dialogClosed":
560 // The onRemoved hook for the popup can create a race condition, so we 560 // The onRemoved hook for the popup can create a race condition, so we
561 // to be careful here. (This is not perfect, but best we can do.) 561 // to be careful here. (This is not perfect, but best we can do.)
562 if (window == window.top && blockelementPopupId == message.popupId) 562 if (window == window.top && blockelementPopupId == message.popupId)
563 { 563 {
564 browser.runtime.sendMessage({ 564 browser.runtime.sendMessage({
565 type: "forward", 565 type: "composer.forward",
566 payload: 566 payload:
567 { 567 {
568 type: "composer.content.finished", 568 type: "composer.content.finished",
569 popupAlreadyClosed: true 569 popupAlreadyClosed: true
570 } 570 }
571 }); 571 });
572 } 572 }
573 break; 573 break;
574 } 574 }
575 }); 575 });
576 576
577 if (window == window.top) 577 if (window == window.top)
578 browser.runtime.sendMessage({type: "composer.ready"}); 578 browser.runtime.sendMessage({type: "composer.ready"});
579 579
580 return true; 580 return true;
581 } 581 }
582 582
583 if (document instanceof HTMLDocument) 583 if (document instanceof HTMLDocument)
584 { 584 {
585 // 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
586 // before document_start content scripts on extension startup. In this case 586 // before document_start content scripts on extension startup. In this case
587 // the ext object is undefined, we fail to initialize, and initializeComposer 587 // the ext object is undefined, we fail to initialize, and initializeComposer
588 // returns false. As a workaround, try again after a timeout. 588 // returns false. As a workaround, try again after a timeout.
589 // https://bugzilla.mozilla.org/show_bug.cgi?id=1395287 589 // https://bugzilla.mozilla.org/show_bug.cgi?id=1395287
590 if (!initializeComposer()) 590 if (!initializeComposer())
591 setTimeout(initializeComposer, 2000); 591 setTimeout(initializeComposer, 2000);
592 } 592 }
OLDNEW
« no previous file with comments | « composer.js ('k') | lib/filterComposer.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld