Bug 1053898 - Update Walker and Node actors to observe mutations in shadow roots;r=bgrins
MozReview-Commit-ID: Djlo8ZC84Vm
--- a/devtools/server/actors/inspector/node.js
+++ b/devtools/server/actors/inspector/node.js
@@ -154,21 +154,21 @@ const NodeActor = protocol.ActorClassWit
return form;
},
/**
* Watch the given document node for mutations using the DOM observer
* API.
*/
- watchDocument: function(callback) {
+ watchDocument: function(doc, callback) {
let node = this.rawNode;
// Create the observer on the node's actor. The node will make sure
// the observer is cleaned up when the actor is released.
- let observer = new node.defaultView.MutationObserver(callback);
+ let observer = new doc.defaultView.MutationObserver(callback);
observer.mergeAttributeRecords = true;
observer.observe(node, {
nativeAnonymousChildList: true,
attributes: true,
characterData: true,
characterDataOldValue: true,
childList: true,
subtree: true
--- a/devtools/server/actors/inspector/walker.js
+++ b/devtools/server/actors/inspector/walker.js
@@ -302,20 +302,21 @@ var WalkerActor = protocol.ActorClassWit
actor = new NodeActor(this, node);
// Add the node actor as a child of this walker actor, assigning
// it an actorID.
this.manage(actor);
this._refMap.set(node, actor);
if (node.nodeType === Ci.nsIDOMNode.DOCUMENT_NODE) {
- actor.watchDocument(this.onMutations);
+ actor.watchDocument(node, this.onMutations);
}
if (actor.isShadowRoot) {
+ actor.watchDocument(node.ownerDocument, this.onMutations);
actor.watchSlotchange(this.onSlotchange);
}
return actor;
},
_onReflows: function(reflows) {
// Going through the nodes the walker knows about, see which ones have