Bug 1037446 - [rule view] Adding new rules fails when document.head is undefined. r=harth
authorGabriel Luong <gabriel.luong@gmail.com>
Fri, 11 Jul 2014 18:02:00 +0200
changeset 215709 92f3431bd29d5db763aa230d47cd7c8e5f0a203d
parent 215707 b257f50981e7f19bb218ead06f5aaadf26c6bb59
child 215710 3d74395f47e0465ed343500aec153c519e232990
push id515
push userraliiev@mozilla.com
push dateMon, 06 Oct 2014 12:51:51 +0000
treeherdermozilla-release@267c7a481bef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersharth
bugs1037446
milestone33.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 1037446 - [rule view] Adding new rules fails when document.head is undefined. r=harth
toolkit/devtools/server/actors/styles.js
--- a/toolkit/devtools/server/actors/styles.js
+++ b/toolkit/devtools/server/actors/styles.js
@@ -554,19 +554,19 @@ var PageStyleActor = protocol.ActorClass
 
   /**
    * Helper function to addNewRule to construct a new style tag in the document.
    * @returns DOMElement of the style tag
    */
   get styleElement() {
     if (!this._styleElement) {
       let document = this.inspector.window.document;
-      let style = document.createElement("style");
+      let style = document.createElementNS("http://www.w3.org/1999/xhtml", "style");
       style.setAttribute("type", "text/css");
-      document.head.appendChild(style);
+      document.documentElement.appendChild(style);
       this._styleElement = style;
     }
 
     return this._styleElement;
   },
 
   /**
    * Adds a new rule, and returns the new StyleRuleActor.