mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-26 10:27:32 +09:00
import FIREFOX_52_6_0esr_RELEASE from mozilla-esr52 hg repo
This commit is contained in:
commit
dcd9973243
150858 changed files with 23884658 additions and 0 deletions
5
services/cloudsync/tests/mochitest/browser.ini
Normal file
5
services/cloudsync/tests/mochitest/browser.ini
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
[DEFAULT]
|
||||
support-files=
|
||||
other_window.html
|
||||
|
||||
[browser_tabEvents.js]
|
||||
79
services/cloudsync/tests/mochitest/browser_tabEvents.js
Normal file
79
services/cloudsync/tests/mochitest/browser_tabEvents.js
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
function test() {
|
||||
|
||||
let local = {};
|
||||
|
||||
Components.utils.import("resource://gre/modules/CloudSync.jsm", local);
|
||||
Components.utils.import("resource:///modules/sessionstore/TabStateFlusher.jsm", local);
|
||||
|
||||
let cloudSync = local.CloudSync();
|
||||
let opentabs = [];
|
||||
|
||||
waitForExplicitFinish();
|
||||
|
||||
let testURL = "chrome://mochitests/content/browser/services/cloudsync/tests/mochitest/other_window.html";
|
||||
let expected = [
|
||||
testURL,
|
||||
testURL+"?x=1",
|
||||
testURL+"?x=%20a",
|
||||
// testURL+"?x=å",
|
||||
];
|
||||
|
||||
let nevents = 0;
|
||||
let nflushed = 0;
|
||||
function handleTabChangeEvent () {
|
||||
cloudSync.tabs.removeEventListener("change", handleTabChangeEvent);
|
||||
++ nevents;
|
||||
info("tab change event " + nevents);
|
||||
next();
|
||||
}
|
||||
|
||||
function getLocalTabs() {
|
||||
cloudSync.tabs.getLocalTabs().then(
|
||||
function (tabs) {
|
||||
for (let tab of tabs) {
|
||||
ok(expected.indexOf(tab.url) >= 0, "found an expected tab");
|
||||
}
|
||||
|
||||
is(tabs.length, expected.length, "found the right number of tabs");
|
||||
|
||||
opentabs.forEach(function (tab) {
|
||||
gBrowser.removeTab(tab);
|
||||
});
|
||||
|
||||
is(nevents, 1, "expected number of change events");
|
||||
|
||||
finish();
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
cloudSync.tabs.addEventListener("change", handleTabChangeEvent);
|
||||
|
||||
expected.forEach(function(url) {
|
||||
let tab = gBrowser.addTab(url);
|
||||
|
||||
function flush() {
|
||||
tab.linkedBrowser.removeEventListener("load", flush, true);
|
||||
local.TabStateFlusher.flush(tab.linkedBrowser).then(() => {
|
||||
++ nflushed;
|
||||
info("flushed " + nflushed);
|
||||
next();
|
||||
});
|
||||
}
|
||||
|
||||
tab.linkedBrowser.addEventListener("load", flush, true);
|
||||
|
||||
opentabs.push(tab);
|
||||
});
|
||||
|
||||
function next() {
|
||||
if (nevents == 1 && nflushed == expected.length) {
|
||||
getLocalTabs();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
7
services/cloudsync/tests/mochitest/other_window.html
Normal file
7
services/cloudsync/tests/mochitest/other_window.html
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/
|
||||
-->
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
</html>
|
||||
Loading…
Add table
Add a link
Reference in a new issue