Bug 1259928 Fix for "View Selection Source" throws TypeError: args is null r=IanN a=IanN for comm-aurora comm-beta comm-esr45 CLOSED TREE DONTBUILD THUNDERBIRD452b1_2016051723_RELBRANCH
authorPhilip Chee <philip.chee@gmail.com>
Tue, 12 Apr 2016 22:29:39 +0800
branchTHUNDERBIRD452b1_2016051723_RELBRANCH
changeset 27079 d03aca46f89ca7513b3f468d4cc10f1578bd39a6
parent 27078 594b60143ff2e7301c05091a37807600e7a851b1
child 27080 29699fbacceaf1d2acc002bd1b7bfd5bc159d578
push id1850
push userclokep@gmail.com
push dateWed, 08 Mar 2017 19:29:12 +0000
treeherdercomm-esr52@028df196b2d9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersIanN, IanN
bugs1259928, 1134585, 1203395
Bug 1259928 Fix for "View Selection Source" throws TypeError: args is null r=IanN a=IanN for comm-aurora comm-beta comm-esr45 CLOSED TREE DONTBUILD Update viewPartialSource() for changes in Bug 1134585 and Bug 1203395. Bug 1134585 - [e10s] "View Selection/MathML Source" in remote browser causes unsafe CPOW usage warning Bug 1203395 - [window mode] View Selection Source fails
suite/common/nsContextMenu.js
--- a/suite/common/nsContextMenu.js
+++ b/suite/common/nsContextMenu.js
@@ -841,39 +841,19 @@ nsContextMenu.prototype = {
 
   // Open clicked-in frame in the same window
   showOnlyThisFrame: function() {
     openTopWin( this.target.ownerDocument.location.href, this.target.ownerDocument.defaultView );
   },
 
   // View Partial Source
   viewPartialSource: function(aContext) {
-    var focusedWindow = document.commandDispatcher.focusedWindow;
-    if (focusedWindow == window)
-      focusedWindow = content;
-
-    var docCharset = null;
-    if (focusedWindow)
-      docCharset = "charset=" + focusedWindow.document.characterSet;
-
-    // "View Selection Source" and others such as "View MathML Source"
-    // are mutually exclusive, with the precedence given to the selection
-    // when there is one
-    var reference = null;
-    if (aContext == "selection")
-      reference = focusedWindow.getSelection();
-    else if (aContext == "mathml")
-      reference = this.target;
-    else
-      throw "not reached";
-
-    var docUrl = null; // unused (and play nice for fragments generated via XSLT too)
-    window.openDialog("chrome://global/content/viewPartialSource.xul",
-                      "_blank", "all,dialog=no",
-                      docUrl, docCharset, reference, aContext);
+    var browser = getBrowser().selectedBrowser;
+    var target = aContext == "mathml" ? this.target : null;
+    gViewSourceUtils.viewPartialSourceInBrowser(browser, target, null);
   },
 
   // Open new "view source" window with the frame's URL.
   viewFrameSource: function() {
     gViewSourceUtils.viewSource({
       browser: this.browser,
       URL: gContextMenuContentData.docLocation,
       outerWindowID: gContextMenuContentData.frameOuterWindowID,