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

Side by Side Diff: lib/aardvark.js

Issue 29327605: Issue 3071 - Element Hiding Helper broken in Thunderbird/SeaMonkey Mail (Closed)
Patch Set: Created Sept. 14, 2015, 6:22 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 | no next file » | 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 Source Code is subject to the terms of the Mozilla Public License 2 * This Source Code is subject to the terms of the Mozilla Public License
3 * version 2.0 (the "License"). You can obtain a copy of the License at 3 * version 2.0 (the "License"). You can obtain a copy of the License at
4 * http://mozilla.org/MPL/2.0/. 4 * http://mozilla.org/MPL/2.0/.
5 */ 5 */
6 6
7 let {Prefs} = require("prefs"); 7 let {Prefs} = require("prefs");
8 8
9 // Make sure to stop selection when we are uninstalled 9 // Make sure to stop selection when we are uninstalled
10 onShutdown.add(() => Aardvark.quit()); 10 onShutdown.add(() => Aardvark.quit());
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 this.boxElem = null; 585 this.boxElem = null;
586 E = id => null; 586 E = id => null;
587 return false; 587 return false;
588 }, 588 },
589 589
590 select: function(elem) 590 select: function(elem)
591 { 591 {
592 if (!elem) 592 if (!elem)
593 return false; 593 return false;
594 594
595 let browser = this.browser;
596 if ("selectedBrowser" in browser) // tabbrowser element
597 browser = browser.selectedBrowser;
598
595 let messageId = ++messageCounter; 599 let messageId = ++messageCounter;
596 let callback = (message) => 600 let callback = (message) =>
597 { 601 {
598 let response = message.data; 602 let response = message.data;
599 if (response.messageId != messageId) 603 if (response.messageId != messageId)
600 return; 604 return;
601 605
602 this.browser.selectedBrowser.messageManager.removeMessageListener( 606 browser.messageManager.removeMessageListener(
603 "ElemHideHelper:GetNodeInfo:Response", 607 "ElemHideHelper:GetNodeInfo:Response",
604 callback 608 callback
605 ); 609 );
606 610
607 if (!response.nodeData) 611 if (!response.nodeData)
608 return; 612 return;
609 613
610 this.window.openDialog("chrome://elemhidehelper/content/composer.xul", 614 this.window.openDialog("chrome://elemhidehelper/content/composer.xul",
611 "_blank", "chrome,centerscreen,resizable,dialog=no", response); 615 "_blank", "chrome,centerscreen,resizable,dialog=no", response);
612 this.quit(); 616 this.quit();
613 }; 617 };
614 618
615 this.browser.selectedBrowser.messageManager.addMessageListener( 619 browser.messageManager.addMessageListener(
616 "ElemHideHelper:GetNodeInfo:Response", 620 "ElemHideHelper:GetNodeInfo:Response",
617 callback 621 callback
618 ); 622 );
619 this.browser.selectedBrowser.messageManager.sendAsyncMessage( 623 browser.messageManager.sendAsyncMessage(
620 "ElemHideHelper:GetNodeInfo", 624 "ElemHideHelper:GetNodeInfo",
621 messageId, 625 messageId,
622 { 626 {
623 element: elem 627 element: elem
624 } 628 }
625 ); 629 );
626 return false; 630 return false;
627 }, 631 },
628 632
629 blinkElement: function(elem) 633 blinkElement: function(elem)
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
795 // Show help box 799 // Show help box
796 helpBox.showPopup(this.browser, -1, -1, "tooltip", "topleft", "topleft"); 800 helpBox.showPopup(this.browser, -1, -1, "tooltip", "topleft", "topleft");
797 return true; 801 return true;
798 } 802 }
799 } 803 }
800 804
801 // Makes sure event handlers like Aardvark.onKeyPress always have the correct 805 // Makes sure event handlers like Aardvark.onKeyPress always have the correct
802 // this pointer set. 806 // this pointer set.
803 for (let method of ["onMouseClick", "onMouseScroll", "onKeyPress", "onPageHide", "onMouseMove", "onAfterPaint", "quit"]) 807 for (let method of ["onMouseClick", "onMouseScroll", "onKeyPress", "onPageHide", "onMouseMove", "onAfterPaint", "quit"])
804 Aardvark[method] = Aardvark[method].bind(Aardvark); 808 Aardvark[method] = Aardvark[method].bind(Aardvark);
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld