Bug 888486 - Use the remote protocol to copy innerHTML/outerHTML. r=paul
authorDave Camp <dcamp@mozilla.com>
Mon, 17 Jun 2013 06:52:55 -0700
changeset 151609 de691ff8c67791447de2e1d1cea6de941fa0544c
parent 151608 ed6e47fb4bfedbd974cd5a7fd895fea788259e01
child 151610 40fcf0ac7aba8f606f139c24103b0138c3ea988f
push id2859
push userakeybl@mozilla.com
push dateMon, 16 Sep 2013 19:14:59 +0000
treeherdermozilla-beta@87d3c51cd2bf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspaul
bugs888486
milestone25.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 888486 - Use the remote protocol to copy innerHTML/outerHTML. r=paul
browser/devtools/inspector/inspector-panel.js
--- a/browser/devtools/inspector/inspector-panel.js
+++ b/browser/devtools/inspector/inspector-panel.js
@@ -630,34 +630,38 @@ InspectorPanel.prototype = {
   /**
    * Copy the innerHTML of the selected Node to the clipboard.
    */
   copyInnerHTML: function InspectorPanel_copyInnerHTML()
   {
     if (!this.selection.isNode()) {
       return;
     }
-    let toCopy = this.selection.node.innerHTML;
-    if (toCopy) {
-      clipboardHelper.copyString(toCopy);
-    }
+    this._copyLongStr(this.walker.innerHTML(this.selection.nodeFront));
   },
 
   /**
    * Copy the outerHTML of the selected Node to the clipboard.
    */
   copyOuterHTML: function InspectorPanel_copyOuterHTML()
   {
     if (!this.selection.isNode()) {
       return;
     }
-    let toCopy = this.selection.node.outerHTML;
-    if (toCopy) {
-      clipboardHelper.copyString(toCopy);
-    }
+
+    this._copyLongStr(this.walker.outerHTML(this.selection.nodeFront));
+  },
+
+  _copyLongStr: function(promise) {
+    return promise.then(longstr => {
+      return longstr.string().then(toCopy => {
+        longstr.release().then(null, console.error);
+        clipboardHelper.copyString(toCopy);
+      });
+    }).then(null, console.error);
   },
 
   /**
    * Copy a unique selector of the selected Node to the clipboard.
    */
   copyUniqueSelector: function InspectorPanel_copyUniqueSelector()
   {
     if (!this.selection.isNode()) {