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
Родитель d7bdc12d32
Коммит 4118321418
2 изменённых файлов: 48 добавлений и 0 удалений

Просмотреть файл

@ -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

Просмотреть файл

@ -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");