Bug 1146568 - Avoid unsafe CPOW usage warnings in browser_markupview_tag_edit_08.js; r=bgrins
authorPatrick Brosset <pbrosset@mozilla.com>
Wed, 25 Mar 2015 11:17:05 +0100
changeset 266016 c2ada63128e0ef31b14518de2051daa8c0c9da0d
parent 266015 386d8cc19d8d4ce51262cdb8e397325a6de13d0f
child 266017 2d5f393a6f8d6c1a13abc363c821d206e455dcdb
push id830
push userraliiev@mozilla.com
push dateFri, 19 Jun 2015 19:24:37 +0000
treeherdermozilla-release@932614382a68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbgrins
bugs1146568
milestone39.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 1146568 - Avoid unsafe CPOW usage warnings in browser_markupview_tag_edit_08.js; r=bgrins Making use of the devtools test frame-script to set the test node's attributes instead of using a CPOW.
browser/devtools/markupview/test/browser_markupview_tag_edit_08.js
browser/devtools/markupview/test/head.js
--- a/browser/devtools/markupview/test/browser_markupview_tag_edit_08.js
+++ b/browser/devtools/markupview/test/browser_markupview_tag_edit_08.js
@@ -20,19 +20,18 @@ add_task(function*() {
   yield testEditingAttributeWithMixedQuotes(inspector);
 });
 
 function* testCollapsedLongAttribute(inspector) {
   info("Try to modify the collapsed long attribute, making sure it expands.");
 
   info("Adding test attributes to the node");
   let onMutated = inspector.once("markupmutation");
-  let node = getNode("#node24");
-  node.setAttribute("class", "");
-  node.setAttribute("data-long", LONG_ATTRIBUTE);
+  yield setNodeAttribute("#node24", "class", "");
+  yield setNodeAttribute("#node24", "data-long", LONG_ATTRIBUTE);
   yield onMutated;
 
   assertAttributes("#node24", {
     id: "node24",
     "class": "",
     "data-long": LONG_ATTRIBUTE
   });
 
--- a/browser/devtools/markupview/test/head.js
+++ b/browser/devtools/markupview/test/head.js
@@ -205,16 +205,28 @@ function getNodeFront(selector, {walker}
  * @param {String} selector.
  * @return {Promise} a promise that resolves to the element's information.
  */
 function getNodeInfo(selector) {
   return executeInContent("devtools:test:getDomElementInfo", {selector});
 }
 
 /**
+ * Set the value of an attribute of a DOM element, identified by its selector.
+ * @param {String} selector.
+ * @param {String} attributeName.
+ * @param {String} attributeValue.
+ * @param {Promise} resolves when done.
+ */
+function setNodeAttribute(selector, attributeName, attributeValue) {
+  return executeInContent("devtools:test:setAttribute",
+                          {selector, attributeName, attributeValue});
+}
+
+/**
  * Highlight a node and set the inspector's current selection to the node or
  * the first match of the given css selector.
  * @param {String|DOMNode} nodeOrSelector
  * @param {InspectorPanel} inspector
  *        The instance of InspectorPanel currently loaded in the toolbox
  * @return a promise that resolves when the inspector is updated with the new
  * node
  */