Bug 884388 - Add inner/outerHTML requests to the walker actor. r=paul

--HG--
extra : rebase_source : 7fe93afb46ce07bf17c9bf503056d345506f17b6
This commit is contained in:
Dave Camp 2013-06-10 21:18:44 -07:00
parent d7bdc12d32
commit 4118321418
2 changed files with 48 additions and 0 deletions

View File

@ -1300,6 +1300,34 @@ var WalkerActor = protocol.ActorClass({
response: {}
}),
/**
* Get a node's innerHTML property.
*/
innerHTML: method(function(node) {
return LongStringActor(this.conn, node.rawNode.innerHTML);
}, {
request: {
node: Arg(0, "domnode")
},
response: {
value: RetVal("longstring")
}
}),
/**
* Get a node's outerHTML property.
*/
outerHTML: method(function(node) {
return LongStringActor(this.conn, node.rawNode.outerHTML);
}, {
request: {
node: Arg(0, "domnode")
},
response: {
value: RetVal("longstring")
}
}),
/**
* Get any pending mutation records. Must be called by the client after
* the `new-mutations` notification is received. Returns an array of

View File

@ -53,6 +53,26 @@ addTest(function testWalkerRoot() {
}).then(runNextTest));
});
addTest(function testInnerHTML() {
promiseDone(gWalker.documentElement().then(docElement => {
return gWalker.innerHTML(docElement);
}).then(longstring => {
return longstring.string();
}).then(innerHTML => {
ok(innerHTML === gInspectee.documentElement.innerHTML, "innerHTML should match");
}).then(runNextTest));
});
addTest(function testOuterHTML() {
promiseDone(gWalker.documentElement().then(docElement => {
return gWalker.outerHTML(docElement);
}).then(longstring => {
return longstring.string();
}).then(outerHTML => {
ok(outerHTML === gInspectee.documentElement.outerHTML, "outerHTML should match");
}).then(runNextTest));
});
addTest(function testQuerySelector() {
promiseDone(gWalker.querySelector(gWalker.rootNode, "#longlist").then(node => {
is(node.getAttribute("data-test"), "exists", "should have found the right node");