зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1445780: Part 1 - Allow synthesizeMouse to accept an array of selectors for content in iframes. r=aswan
MozReview-Commit-ID: JCRagaqkkZ6 --HG-- extra : rebase_source : 81d1bd14030b41196c951512c26025e2cf0db9ac
This commit is contained in:
Родитель
4f1d6d3f42
Коммит
ef176184cb
|
@ -1011,6 +1011,9 @@ var BrowserTestUtils = {
|
|||
* One of the following:
|
||||
* - a selector string that identifies the element to target. The syntax is as
|
||||
* for querySelector.
|
||||
* - An array of selector strings. Each selector after the first
|
||||
* selects for an element in the iframe specified by the previous
|
||||
* selector.
|
||||
* - a CPOW element (for easier test-conversion).
|
||||
* - a function to be run in the content process that returns the element to
|
||||
* target
|
||||
|
@ -1045,7 +1048,7 @@ var BrowserTestUtils = {
|
|||
if (typeof target == "function") {
|
||||
targetFn = target.toString();
|
||||
target = null;
|
||||
} else if (typeof target != "string") {
|
||||
} else if (typeof target != "string" && !Array.isArray(target)) {
|
||||
cpowObject = target;
|
||||
target = null;
|
||||
}
|
||||
|
|
|
@ -25,6 +25,13 @@ addMessageListener("Test:SynthesizeMouse", (message) => {
|
|||
if (typeof target == "string") {
|
||||
target = content.document.querySelector(target);
|
||||
}
|
||||
else if (Array.isArray(target)) {
|
||||
let elem = {contentDocument: content.document};
|
||||
for (let sel of target) {
|
||||
elem = elem.contentDocument.querySelector(sel);
|
||||
}
|
||||
target = elem;
|
||||
}
|
||||
else if (typeof data.targetFn == "string") {
|
||||
let runnablestr = `
|
||||
(() => {
|
||||
|
|
Загрузка…
Ссылка в новой задаче