mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1155493 - Part 4: Add test for mozbrowsercaretstatechanged. r=kchen
This commit is contained in:
parent
cb0b085920
commit
bb669f48bb
@ -65,6 +65,10 @@ const browserElementTestHelpers = {
|
||||
this._setPref('selectioncaret.enabled', value);
|
||||
},
|
||||
|
||||
setAccessibleCaretEnabledPref: function(value) {
|
||||
this._setPref('layout.accessiblecaret.enabled', value);
|
||||
},
|
||||
|
||||
getOOPByDefaultPref: function() {
|
||||
return this._getBoolPref("dom.ipc.browser_frames.oop_by_default");
|
||||
},
|
||||
|
@ -21,6 +21,7 @@ var defaultData;
|
||||
var pasteData;
|
||||
var focusScript;
|
||||
var createEmbededFrame = false;
|
||||
var testAccessibleCaret = false;
|
||||
|
||||
function copyToClipboard(str) {
|
||||
gTextarea.value = str;
|
||||
@ -160,16 +161,24 @@ function dispatchTest(e) {
|
||||
break;
|
||||
default:
|
||||
if (createEmbededFrame || browserElementTestHelpers.getOOPByDefaultPref()) {
|
||||
if (testAccessibleCaret) {
|
||||
SimpleTest.finish();
|
||||
return;
|
||||
} else {
|
||||
testAccessibleCaret = true;
|
||||
createEmbededFrame = false;
|
||||
browserElementTestHelpers.setSelectionChangeEnabledPref(false);
|
||||
browserElementTestHelpers.setAccessibleCaretEnabledPref(true);
|
||||
}
|
||||
} else {
|
||||
createEmbededFrame = true;
|
||||
}
|
||||
|
||||
// clean up and run test again.
|
||||
document.body.removeChild(iframeOuter);
|
||||
document.body.removeChild(gTextarea);
|
||||
state = 0;
|
||||
runTest();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -183,14 +192,17 @@ function isChildProcess() {
|
||||
function testSelectAll(e) {
|
||||
// Skip mozbrowser test if we're at child process.
|
||||
if (!isChildProcess()) {
|
||||
iframeOuter.addEventListener("mozbrowserselectionstatechanged", function selectchangeforselectall(e) {
|
||||
if (e.detail.states.indexOf('selectall') == 0) {
|
||||
iframeOuter.removeEventListener("mozbrowserselectionstatechanged", selectchangeforselectall, true);
|
||||
let eventName = testAccessibleCaret ? "mozbrowsercaretstatechanged" : "mozbrowserselectionstatechanged";
|
||||
iframeOuter.addEventListener(eventName, function selectchangeforselectall(e) {
|
||||
if (!e.detail.states || e.detail.states.indexOf('selectall') == 0) {
|
||||
iframeOuter.removeEventListener(eventName, selectchangeforselectall, true);
|
||||
ok(true, "got mozbrowserselectionstatechanged event." + stateMeaning);
|
||||
ok(e.detail, "event.detail is not null." + stateMeaning);
|
||||
ok(e.detail.width != 0, "event.detail.width is not zero" + stateMeaning);
|
||||
ok(e.detail.height != 0, "event.detail.height is not zero" + stateMeaning);
|
||||
if (!testAccessibleCaret) {
|
||||
ok(e.detail.states, "event.detail.state " + e.detail.states);
|
||||
}
|
||||
SimpleTest.executeSoon(function() { testCopy1(e); });
|
||||
}
|
||||
}, true);
|
||||
|
Loading…
Reference in New Issue
Block a user