mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Merge m-c to inbound a=merge
--HG-- rename : toolkit/components/places/tests/expiration/test_removeAllPages.js => toolkit/components/places/tests/expiration/test_clearHistory.js rename : toolkit/components/places/tests/unit/test_history_removeAllPages.js => toolkit/components/places/tests/unit/test_history_clear.js extra : rebase_source : 07ea424f44b029b061b0ee863312dff179c760d3
This commit is contained in:
commit
8025281b09
@ -15,7 +15,7 @@
|
||||
<project name="platform_build" path="build" remote="b2g" revision="e06971db7acf7a35c32eb74d675a4e12e288e6be">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="e45c5dbdcfc2d598c889dfbea72fa11157422afe"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="917b6c36717fddc6e71ffc1ec249633c8044c93c"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="2262d4a77d4f46ab230fd747bb91e9b77bad36cb"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
|
@ -19,7 +19,7 @@
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="e45c5dbdcfc2d598c889dfbea72fa11157422afe"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="917b6c36717fddc6e71ffc1ec249633c8044c93c"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="2262d4a77d4f46ab230fd747bb91e9b77bad36cb"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="d5d3f93914558b6f168447b805cd799c8233e300"/>
|
||||
|
@ -17,7 +17,7 @@
|
||||
</project>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="e45c5dbdcfc2d598c889dfbea72fa11157422afe"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="917b6c36717fddc6e71ffc1ec249633c8044c93c"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="2262d4a77d4f46ab230fd747bb91e9b77bad36cb"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="fe893bb760a3bb64375f62fdf4762a58c59df9ef"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="fe91ec3af5396edab45b15e546e21613785724b5"/>
|
||||
|
@ -15,7 +15,7 @@
|
||||
<project name="platform_build" path="build" remote="b2g" revision="e06971db7acf7a35c32eb74d675a4e12e288e6be">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="e45c5dbdcfc2d598c889dfbea72fa11157422afe"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="917b6c36717fddc6e71ffc1ec249633c8044c93c"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="2262d4a77d4f46ab230fd747bb91e9b77bad36cb"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
|
@ -19,7 +19,7 @@
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="e45c5dbdcfc2d598c889dfbea72fa11157422afe"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="917b6c36717fddc6e71ffc1ec249633c8044c93c"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="2262d4a77d4f46ab230fd747bb91e9b77bad36cb"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="d5d3f93914558b6f168447b805cd799c8233e300"/>
|
||||
|
@ -15,7 +15,7 @@
|
||||
<project name="platform_build" path="build" remote="b2g" revision="e06971db7acf7a35c32eb74d675a4e12e288e6be">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="e45c5dbdcfc2d598c889dfbea72fa11157422afe"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="917b6c36717fddc6e71ffc1ec249633c8044c93c"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="2262d4a77d4f46ab230fd747bb91e9b77bad36cb"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
|
@ -17,7 +17,7 @@
|
||||
</project>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="e45c5dbdcfc2d598c889dfbea72fa11157422afe"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="917b6c36717fddc6e71ffc1ec249633c8044c93c"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="2262d4a77d4f46ab230fd747bb91e9b77bad36cb"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="fe893bb760a3bb64375f62fdf4762a58c59df9ef"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="fe91ec3af5396edab45b15e546e21613785724b5"/>
|
||||
|
@ -1,9 +1,9 @@
|
||||
{
|
||||
"git": {
|
||||
"git_revision": "e45c5dbdcfc2d598c889dfbea72fa11157422afe",
|
||||
"git_revision": "917b6c36717fddc6e71ffc1ec249633c8044c93c",
|
||||
"remote": "https://git.mozilla.org/releases/gaia.git",
|
||||
"branch": ""
|
||||
},
|
||||
"revision": "ecc956a2747963c2db6edf513cd3a8a75ca8884a",
|
||||
"revision": "3033c2214b5863d8ac50d2067b34c5cb02fb054d",
|
||||
"repo_path": "integration/gaia-central"
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="e45c5dbdcfc2d598c889dfbea72fa11157422afe"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="917b6c36717fddc6e71ffc1ec249633c8044c93c"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="2262d4a77d4f46ab230fd747bb91e9b77bad36cb"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="fe893bb760a3bb64375f62fdf4762a58c59df9ef"/>
|
||||
|
@ -15,7 +15,7 @@
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="e45c5dbdcfc2d598c889dfbea72fa11157422afe"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="917b6c36717fddc6e71ffc1ec249633c8044c93c"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="2262d4a77d4f46ab230fd747bb91e9b77bad36cb"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
|
@ -17,7 +17,7 @@
|
||||
</project>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="e45c5dbdcfc2d598c889dfbea72fa11157422afe"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="917b6c36717fddc6e71ffc1ec249633c8044c93c"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="2262d4a77d4f46ab230fd747bb91e9b77bad36cb"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="fe893bb760a3bb64375f62fdf4762a58c59df9ef"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="fe91ec3af5396edab45b15e546e21613785724b5"/>
|
||||
|
@ -17,7 +17,7 @@
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="e45c5dbdcfc2d598c889dfbea72fa11157422afe"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="917b6c36717fddc6e71ffc1ec249633c8044c93c"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="2262d4a77d4f46ab230fd747bb91e9b77bad36cb"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
|
@ -26,7 +26,7 @@ add_task(function* () {
|
||||
gBrowser.removeTab(tab);
|
||||
} catch(ex) { /* tab may have already been closed in case of failure */ }
|
||||
|
||||
return promiseClearHistory();
|
||||
return PlacesTestUtils.clearHistory();
|
||||
});
|
||||
|
||||
yield promiseAutocompleteResultPopup("open a search");
|
||||
|
@ -26,7 +26,7 @@ add_task(function* () {
|
||||
gBrowser.removeTab(tab);
|
||||
} catch(ex) { /* tab may have already been closed in case of failure */ }
|
||||
|
||||
return promiseClearHistory();
|
||||
return PlacesTestUtils.clearHistory();
|
||||
});
|
||||
|
||||
yield promiseAutocompleteResultPopup("moz open a search");
|
||||
|
@ -15,7 +15,7 @@ add_task(function*() {
|
||||
return;
|
||||
}
|
||||
|
||||
registerCleanupFunction(promiseClearHistory);
|
||||
registerCleanupFunction(() => PlacesTestUtils.clearHistory());
|
||||
|
||||
let visits = [];
|
||||
repeat(10, i => {
|
||||
|
@ -15,7 +15,7 @@ add_task(function*() {
|
||||
return;
|
||||
}
|
||||
|
||||
registerCleanupFunction(promiseClearHistory);
|
||||
registerCleanupFunction(() => PlacesTestUtils.clearHistory());
|
||||
|
||||
let visits = [];
|
||||
repeat(10, i => {
|
||||
|
@ -66,5 +66,5 @@ add_task(function* test_switchtab_override() {
|
||||
EventUtils.synthesizeKey("VK_SHIFT" , { type: "keyup" });
|
||||
yield deferred.promise;
|
||||
|
||||
yield promiseClearHistory();
|
||||
yield PlacesTestUtils.clearHistory();
|
||||
});
|
||||
|
@ -18,7 +18,7 @@ add_task(function* test_switchtab_override_keynav() {
|
||||
gBrowser.removeTab(tab);
|
||||
gBrowser.removeTab(secondTab);
|
||||
} catch(ex) { /* tabs may have already been closed in case of failure */ }
|
||||
return promiseClearHistory();
|
||||
return PlacesTestUtils.clearHistory();
|
||||
});
|
||||
|
||||
gURLBar.focus();
|
||||
|
@ -70,22 +70,6 @@ function onPanelShown(aEvent) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears history invoking callback when done.
|
||||
*/
|
||||
function waitForClearHistory(aCallback)
|
||||
{
|
||||
let observer = {
|
||||
observe: function(aSubject, aTopic, aData)
|
||||
{
|
||||
Services.obs.removeObserver(this, PlacesUtils.TOPIC_EXPIRATION_FINISHED);
|
||||
aCallback(aSubject, aTopic, aData);
|
||||
}
|
||||
};
|
||||
Services.obs.addObserver(observer, PlacesUtils.TOPIC_EXPIRATION_FINISHED, false);
|
||||
PlacesUtils.bhistory.removeAllPages();
|
||||
}
|
||||
|
||||
function onPanelHidden(aEvent) {
|
||||
if (aEvent.target == StarUI.panel) {
|
||||
StarUI.panel.removeEventListener("popuphidden", arguments.callee, false);
|
||||
@ -96,7 +80,7 @@ function onPanelHidden(aEvent) {
|
||||
is(BookmarkingUI.status, BookmarkingUI.STATUS_UNSTARRED,
|
||||
"star button indicates that the bookmark has been removed");
|
||||
gBrowser.removeCurrentTab();
|
||||
waitForClearHistory(finish);
|
||||
PlacesTestUtils.clearHistory().then(finish);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -976,40 +976,32 @@ function formNameExists(name)
|
||||
* Removes all history visits, downloads, and form entries.
|
||||
*/
|
||||
function blankSlate() {
|
||||
PlacesUtils.bhistory.removeAllPages();
|
||||
|
||||
// The promise is resolved only when removing both downloads and form history are done.
|
||||
let deferred = Promise.defer();
|
||||
let formHistoryDone = false, downloadsDone = false;
|
||||
|
||||
Task.spawn(function deleteAllDownloads() {
|
||||
let deleteDownloads = Task.spawn(function* deleteAllDownloads() {
|
||||
let publicList = yield Downloads.getList(Downloads.PUBLIC);
|
||||
let downloads = yield publicList.getAll();
|
||||
for (let download of downloads) {
|
||||
yield publicList.remove(download);
|
||||
yield download.finalize(true);
|
||||
}
|
||||
downloadsDone = true;
|
||||
if (formHistoryDone) {
|
||||
deferred.resolve();
|
||||
}
|
||||
}).then(null, Components.utils.reportError);
|
||||
|
||||
FormHistory.update({ op: "remove" },
|
||||
{ handleError: function (error) {
|
||||
do_throw("Error occurred updating form history: " + error);
|
||||
deferred.reject(error);
|
||||
},
|
||||
handleCompletion: function (reason) {
|
||||
if (!reason) {
|
||||
formHistoryDone = true;
|
||||
if (downloadsDone) {
|
||||
deferred.resolve();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
return deferred.promise;
|
||||
let updateFormHistory = new Promise((resolve, reject) => {
|
||||
FormHistory.update({op: "remove"}, {
|
||||
handleCompletion(reason) {
|
||||
if (!reason) {
|
||||
resolve();
|
||||
}
|
||||
},
|
||||
|
||||
handleError(error) {
|
||||
do_throw("Error occurred updating form history: " + error);
|
||||
reject(error);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
return Promise.all([
|
||||
PlacesTestUtils.clearHistory(), deleteDownloads, updateFormHistory]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -72,7 +72,7 @@ registerCleanupFunction(() => {
|
||||
Services.prefs.clearUserPref(gRestyleSearchesPref);
|
||||
Services.search.currentEngine = gOriginalEngine;
|
||||
Services.search.removeEngine(gEngine);
|
||||
return promiseClearHistory();
|
||||
return PlacesTestUtils.clearHistory();
|
||||
});
|
||||
|
||||
add_task(function*() {
|
||||
|
@ -150,8 +150,7 @@ function nextStep() {
|
||||
gBrowser.removeCurrentTab();
|
||||
}
|
||||
|
||||
waitForClearHistory(finish);
|
||||
|
||||
PlacesTestUtils.clearHistory().then(finish);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -184,22 +183,6 @@ function ensure_opentabs_match_db(aCallback) {
|
||||
checkAutocompleteResults(tabs, aCallback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears history invoking callback when done.
|
||||
*/
|
||||
function waitForClearHistory(aCallback) {
|
||||
const TOPIC_EXPIRATION_FINISHED = "places-expiration-finished";
|
||||
let observer = {
|
||||
observe: function(aSubject, aTopic, aData) {
|
||||
Services.obs.removeObserver(this, TOPIC_EXPIRATION_FINISHED);
|
||||
aCallback();
|
||||
}
|
||||
};
|
||||
Services.obs.addObserver(observer, TOPIC_EXPIRATION_FINISHED, false);
|
||||
|
||||
PlacesUtils.bhistory.removeAllPages();
|
||||
}
|
||||
|
||||
function checkAutocompleteResults(aExpected, aCallback)
|
||||
{
|
||||
gController.input = {
|
||||
|
@ -61,20 +61,12 @@ function continue_test() {
|
||||
EventUtils.synthesizeKey("VK_DOWN", {});
|
||||
is(gURLBar.textValue, "www.autofilltrimurl.com/whatever", "trim was applied correctly");
|
||||
gURLBar.closePopup();
|
||||
waitForClearHistory(finish);
|
||||
PlacesTestUtils.clearHistory().then(finish);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function waitForClearHistory(aCallback) {
|
||||
Services.obs.addObserver(function observeCH(aSubject, aTopic, aData) {
|
||||
Services.obs.removeObserver(observeCH, PlacesUtils.TOPIC_EXPIRATION_FINISHED);
|
||||
aCallback();
|
||||
}, PlacesUtils.TOPIC_EXPIRATION_FINISHED, false);
|
||||
PlacesUtils.bhistory.removeAllPages();
|
||||
}
|
||||
|
||||
let gOnSearchComplete = null;
|
||||
function waitForSearchComplete(aCallback) {
|
||||
info("Waiting for onSearchComplete");
|
||||
|
@ -16,9 +16,9 @@ function is_selected(index) {
|
||||
}
|
||||
|
||||
add_task(function*() {
|
||||
registerCleanupFunction(promiseClearHistory);
|
||||
registerCleanupFunction(() => PlacesTestUtils.clearHistory());
|
||||
|
||||
yield promiseClearHistory();
|
||||
yield PlacesTestUtils.clearHistory();
|
||||
let tabCount = gBrowser.tabs.length;
|
||||
|
||||
let visits = [];
|
||||
|
@ -383,40 +383,6 @@ function promiseHistoryClearedState(aURIs, aShouldBeCleared) {
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows waiting for an observer notification once.
|
||||
*
|
||||
* @param topic
|
||||
* Notification topic to observe.
|
||||
*
|
||||
* @return {Promise}
|
||||
* @resolves The array [subject, data] from the observed notification.
|
||||
* @rejects Never.
|
||||
*/
|
||||
function promiseTopicObserved(topic)
|
||||
{
|
||||
let deferred = Promise.defer();
|
||||
info("Waiting for observer topic " + topic);
|
||||
Services.obs.addObserver(function PTO_observe(subject, topic, data) {
|
||||
Services.obs.removeObserver(PTO_observe, topic);
|
||||
deferred.resolve([subject, data]);
|
||||
}, topic, false);
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears history asynchronously.
|
||||
*
|
||||
* @return {Promise}
|
||||
* @resolves When history has been cleared.
|
||||
* @rejects Never.
|
||||
*/
|
||||
function promiseClearHistory() {
|
||||
let promise = promiseTopicObserved(PlacesUtils.TOPIC_EXPIRATION_FINISHED);
|
||||
PlacesUtils.bhistory.removeAllPages();
|
||||
return promise;
|
||||
}
|
||||
|
||||
/**
|
||||
* Waits for the next top-level document load in the current browser. The URI
|
||||
* of the document is compared against aExpectedURL. The load is then stopped
|
||||
|
@ -10,11 +10,12 @@ let tmp = {};
|
||||
Cu.import("resource://gre/modules/Promise.jsm", tmp);
|
||||
Cu.import("resource://gre/modules/NewTabUtils.jsm", tmp);
|
||||
Cu.import("resource:///modules/DirectoryLinksProvider.jsm", tmp);
|
||||
Cu.import("resource://testing-common/PlacesTestUtils.jsm", tmp);
|
||||
Cc["@mozilla.org/moz/jssubscript-loader;1"]
|
||||
.getService(Ci.mozIJSSubScriptLoader)
|
||||
.loadSubScript("chrome://browser/content/sanitize.js", tmp);
|
||||
Cu.import("resource://gre/modules/Timer.jsm", tmp);
|
||||
let {Promise, NewTabUtils, Sanitizer, clearTimeout, setTimeout, DirectoryLinksProvider} = tmp;
|
||||
let {Promise, NewTabUtils, Sanitizer, clearTimeout, setTimeout, DirectoryLinksProvider, PlacesTestUtils} = tmp;
|
||||
|
||||
let uri = Services.io.newURI("about:newtab", null, null);
|
||||
let principal = Services.scriptSecurityManager.getNoAppCodebasePrincipal(uri);
|
||||
@ -154,7 +155,7 @@ let TestRunner = {
|
||||
*/
|
||||
finish: function () {
|
||||
function cleanupAndFinish() {
|
||||
clearHistory(function () {
|
||||
PlacesTestUtils.clearHistory().then(() => {
|
||||
whenPagesUpdated(finish);
|
||||
NewTabUtils.restore();
|
||||
});
|
||||
@ -229,7 +230,7 @@ function setLinks(aLinks, aCallback = TestRunner.next) {
|
||||
// given entries and call populateCache() now again to make sure the cache
|
||||
// has the desired contents.
|
||||
NewTabUtils.links.populateCache(function () {
|
||||
clearHistory(function () {
|
||||
PlacesTestUtils.clearHistory().then(() => {
|
||||
fillHistory(links, function () {
|
||||
NewTabUtils.links.populateCache(function () {
|
||||
NewTabUtils.allPages.update();
|
||||
@ -240,15 +241,6 @@ function setLinks(aLinks, aCallback = TestRunner.next) {
|
||||
});
|
||||
}
|
||||
|
||||
function clearHistory(aCallback) {
|
||||
Services.obs.addObserver(function observe(aSubject, aTopic, aData) {
|
||||
Services.obs.removeObserver(observe, aTopic);
|
||||
executeSoon(aCallback);
|
||||
}, PlacesUtils.TOPIC_EXPIRATION_FINISHED, false);
|
||||
|
||||
PlacesUtils.history.removeAllPages();
|
||||
}
|
||||
|
||||
function fillHistory(aLinks, aCallback = TestRunner.next) {
|
||||
let numLinks = aLinks.length;
|
||||
if (!numLinks) {
|
||||
|
@ -2211,7 +2211,6 @@
|
||||
_doorhangerTitle.value =
|
||||
gNavigatorBundle.getFormattedString(
|
||||
"badContentBlocked.notblocked.message", [this._brandShortName]);
|
||||
|
||||
if (this.notification.options.state &
|
||||
Ci.nsIWebProgressListener.STATE_BLOCKED_MIXED_ACTIVE_CONTENT) {
|
||||
_doorhangerTitle.value =
|
||||
@ -2252,6 +2251,10 @@
|
||||
Services.urlFormatter.formatURLPref("app.support.baseURL")
|
||||
+ "tracking-protection";
|
||||
}
|
||||
if (Services.prefs.getBoolPref("privacy.trackingprotection.enabled")) {
|
||||
let histogram = Services.telemetry.getHistogramById("TRACKING_PROTECTION_EVENTS");
|
||||
histogram.add(0);
|
||||
}
|
||||
]]></constructor>
|
||||
<method name="disableMixedContentProtection">
|
||||
<body><![CDATA[
|
||||
@ -2283,7 +2286,7 @@
|
||||
null, null);
|
||||
// Add the current host in the 'trackingprotection' consumer of
|
||||
// the permission manager using a normalized URI. This effectively
|
||||
// places this host on the tracking protection white list.
|
||||
// places this host on the tracking protection allowlist.
|
||||
Services.perms.add(normalizedUrl,
|
||||
"trackingprotection", Services.perms.ALLOW_ACTION);
|
||||
// Telemetry for disable protection
|
||||
@ -2297,7 +2300,7 @@
|
||||
<body><![CDATA[
|
||||
// Remove the current host from the 'trackingprotection' consumer
|
||||
// of the permission manager. This effectively removes this host
|
||||
// from the tracking protection white list (any list actually).
|
||||
// from the tracking protection allowlist.
|
||||
Services.perms.remove(gBrowser.selectedBrowser.currentURI.host,
|
||||
"trackingprotection");
|
||||
// Telemetry for enable protection
|
||||
|
@ -13,6 +13,17 @@
|
||||
<link rel="stylesheet" type="text/css" href="shared/css/conversation.css">
|
||||
<link rel="stylesheet" type="text/css" href="css/webapp.css">
|
||||
<link rel="localization" href="l10n/{locale}/loop.properties">
|
||||
|
||||
<script>
|
||||
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
||||
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
||||
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
||||
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
||||
|
||||
ga('create', 'UA-36116321-15', 'auto');
|
||||
ga('send', 'pageview');
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body class="standalone">
|
||||
|
||||
|
@ -19,6 +19,7 @@ loop.webapp = (function($, _, OT, mozL10n) {
|
||||
var sharedModels = loop.shared.models;
|
||||
var sharedViews = loop.shared.views;
|
||||
var sharedUtils = loop.shared.utils;
|
||||
var WEBSOCKET_REASONS = loop.shared.utils.WEBSOCKET_REASONS;
|
||||
|
||||
var multiplexGum = loop.standaloneMedia.multiplexGum;
|
||||
|
||||
@ -892,7 +893,7 @@ loop.webapp = (function($, _, OT, mozL10n) {
|
||||
_handleCallTerminated: function(reason) {
|
||||
multiplexGum.reset();
|
||||
|
||||
if (reason === "cancel") {
|
||||
if (reason === WEBSOCKET_REASONS.CANCEL) {
|
||||
this.setState({callStatus: "start"});
|
||||
return;
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ FIREFOX_PREFERENCES = {
|
||||
# Some more changes might be necesarry to have this working in offline mode
|
||||
"media.peerconnection.default_iceservers": "[]",
|
||||
"media.peerconnection.use_document_iceservers": False,
|
||||
"stun.allow_loopback": True,
|
||||
"media.peerconnection.ice.loopback": True,
|
||||
"devtools.chrome.enabled": True,
|
||||
"devtools.debugger.prompt-connection": False,
|
||||
"devtools.debugger.remote-enabled": True,
|
||||
|
@ -10,6 +10,8 @@ import os
|
||||
import sys
|
||||
sys.path.insert(1, os.path.dirname(os.path.abspath(__file__)))
|
||||
|
||||
import pyperclip
|
||||
|
||||
from serversetup import LoopTestServers
|
||||
from config import *
|
||||
|
||||
@ -39,13 +41,29 @@ class Test1BrowserCall(MarionetteTestCase):
|
||||
.until(lambda m: m.find_element(by, locator).is_displayed())
|
||||
return self.marionette.find_element(by, locator)
|
||||
|
||||
# XXX workaround for Marionette bug 1055309
|
||||
def wait_for_subelement_displayed(self, parent, by, locator, timeout=None):
|
||||
Wait(self.marionette, timeout,
|
||||
ignored_exceptions=[NoSuchElementException, StaleElementException])\
|
||||
.until(lambda m: parent.find_element(by, locator).is_displayed())
|
||||
return parent.find_element(by, locator)
|
||||
|
||||
# XXX workaround for Marionette bug 1094246
|
||||
def wait_for_element_exists(self, by, locator, timeout=None):
|
||||
Wait(self.marionette, timeout,
|
||||
ignored_exceptions=[NoSuchElementException, StaleElementException]) \
|
||||
.until(lambda m: m.find_element(by, locator))
|
||||
return self.marionette.find_element(by, locator)
|
||||
|
||||
def wait_for_element_enabled(self, element, timeout=10):
|
||||
Wait(self.marionette, timeout) \
|
||||
.until(lambda e: element.is_enabled(),
|
||||
message="Timed out waiting for element to be enabled")
|
||||
|
||||
def wait_for_element_attribute_to_be_false(self, element, attribute, timeout=10):
|
||||
Wait(self.marionette, timeout) \
|
||||
.until(lambda e: element.get_attribute(attribute) == "false",
|
||||
message="Timeout out waiting for " + attribute + " to be false")
|
||||
|
||||
def switch_to_panel(self):
|
||||
button = self.marionette.find_element(By.ID, "loop-button")
|
||||
|
||||
@ -56,66 +74,80 @@ class Test1BrowserCall(MarionetteTestCase):
|
||||
frame = self.marionette.find_element(By.ID, "loop-panel-iframe")
|
||||
self.marionette.switch_to_frame(frame)
|
||||
|
||||
def load_and_verify_standalone_ui(self, url):
|
||||
self.marionette.set_context("content")
|
||||
self.marionette.navigate(url)
|
||||
|
||||
def start_a_conversation(self):
|
||||
# TODO: wait for react elements
|
||||
sleep(2)
|
||||
button = self.marionette.find_element(By.CSS_SELECTOR, ".rooms .btn-info")
|
||||
|
||||
# click the element
|
||||
button.click()
|
||||
|
||||
def get_and_verify_call_url(self):
|
||||
# in the new room model we have to first start a conversation
|
||||
self.start_a_conversation()
|
||||
|
||||
# TODO: wait for react elements
|
||||
sleep(2)
|
||||
call_url = self.marionette.find_element(By.CLASS_NAME, \
|
||||
"room-url-link").text
|
||||
|
||||
self.assertIn(urlparse.urlparse(call_url).scheme, ['http', 'https'],
|
||||
"call URL returned by server " + call_url +
|
||||
" has invalid scheme")
|
||||
return call_url
|
||||
|
||||
def start_and_verify_outgoing_call(self):
|
||||
# TODO: wait for react elements
|
||||
sleep(2)
|
||||
# make the call!
|
||||
call_button = self.marionette.find_element(By.CLASS_NAME,
|
||||
"btn-join")
|
||||
call_button.click()
|
||||
|
||||
def accept_and_verify_incoming_call(self):
|
||||
def switch_to_chatbox(self):
|
||||
self.marionette.set_context("chrome")
|
||||
self.marionette.switch_to_frame()
|
||||
|
||||
# XXX should be using wait_for_element_displayed, but need to wait
|
||||
# for Marionette bug 1055309 to be fixed.
|
||||
# for Marionette bug 1094246 to be fixed.
|
||||
chatbox = self.wait_for_element_exists(By.TAG_NAME, 'chatbox')
|
||||
script = ("return document.getAnonymousElementByAttribute("
|
||||
"arguments[0], 'class', 'chat-frame');")
|
||||
frame = self.marionette.execute_script(script, [chatbox])
|
||||
self.marionette.switch_to_frame(frame)
|
||||
|
||||
# expect a video container on desktop side
|
||||
video = self.wait_for_element_displayed(By.CLASS_NAME, "media")
|
||||
self.assertEqual(video.tag_name, "div", "expect a video container")
|
||||
def switch_to_standalone(self):
|
||||
self.marionette.set_context("content")
|
||||
|
||||
def hangup_call_and_verify_feedback(self):
|
||||
self.marionette.set_context("chrome")
|
||||
def local_start_a_conversation(self):
|
||||
button = self.marionette.find_element(By.CSS_SELECTOR, ".rooms .btn-info")
|
||||
|
||||
self.wait_for_element_enabled(button, 120)
|
||||
|
||||
button.click()
|
||||
|
||||
def local_check_room_self_video(self):
|
||||
self.switch_to_chatbox()
|
||||
|
||||
# expect a video container on desktop side
|
||||
media_container = self.wait_for_element_displayed(By.CLASS_NAME, "media")
|
||||
self.assertEqual(media_container.tag_name, "div", "expect a video container")
|
||||
|
||||
def local_get_and_verify_room_url(self):
|
||||
button = self.wait_for_element_displayed(By.CLASS_NAME, "btn-copy")
|
||||
|
||||
button.click()
|
||||
|
||||
# click the element
|
||||
room_url = pyperclip.paste()
|
||||
|
||||
self.assertIn(urlparse.urlparse(room_url).scheme, ['http', 'https'],
|
||||
"room URL returned by server " + room_url +
|
||||
" has invalid scheme")
|
||||
return room_url
|
||||
|
||||
def standalone_load_and_join_room(self, url):
|
||||
self.switch_to_standalone()
|
||||
self.marionette.navigate(url)
|
||||
|
||||
# Join the room
|
||||
join_button = self.wait_for_element_displayed(By.CLASS_NAME,
|
||||
"btn-join")
|
||||
join_button.click()
|
||||
|
||||
# Assumes the standlone or the conversation window is selected first.
|
||||
def check_remote_video(self):
|
||||
# TODO: This is disabled currently due to bug 1122486
|
||||
# video_wrapper = self.wait_for_element_displayed(By.CSS_SELECTOR, ".media .OT_subscriber .OT_video-container", 20)
|
||||
# video = self.wait_for_subelement_displayed(video_wrapper, By.TAG_NAME, "video")
|
||||
|
||||
# self.wait_for_element_attribute_to_be_false(video, "paused")
|
||||
# self.assertEqual(video.get_attribute("ended"), "false")
|
||||
|
||||
# Due to the above waits being disabled, we do a sleep.
|
||||
sleep(15)
|
||||
|
||||
def standalone_check_remote_video(self):
|
||||
self.switch_to_standalone()
|
||||
self.check_remote_video()
|
||||
|
||||
def local_check_remote_video(self):
|
||||
self.switch_to_chatbox()
|
||||
self.check_remote_video()
|
||||
|
||||
def local_leave_room_and_verify_feedback(self):
|
||||
button = self.marionette.find_element(By.CLASS_NAME, "btn-hangup")
|
||||
|
||||
# XXX bug 1080095 For whatever reason, the click doesn't take effect
|
||||
# unless we wait for a bit (even if we wait for the element to
|
||||
# actually be displayed first, which we're not currently bothering
|
||||
# with). It's not entirely clear whether the click is being
|
||||
# delivered in this case, or whether there's a Marionette bug here.
|
||||
sleep(5)
|
||||
button.click()
|
||||
|
||||
# check that the feedback form is displayed
|
||||
@ -125,22 +157,22 @@ class Test1BrowserCall(MarionetteTestCase):
|
||||
def test_1_browser_call(self):
|
||||
self.switch_to_panel()
|
||||
|
||||
call_url = self.get_and_verify_call_url()
|
||||
self.local_start_a_conversation()
|
||||
|
||||
# Check the self video in the conversation window
|
||||
self.local_check_room_self_video()
|
||||
|
||||
room_url = self.local_get_and_verify_room_url()
|
||||
|
||||
# load the link clicker interface into the current content browser
|
||||
self.load_and_verify_standalone_ui(call_url)
|
||||
self.standalone_load_and_join_room(room_url)
|
||||
|
||||
self.start_and_verify_outgoing_call()
|
||||
|
||||
# Switch to the conversation window and answer
|
||||
self.accept_and_verify_incoming_call()
|
||||
|
||||
# Let's wait for the call/media to get established.
|
||||
# TODO: replace this with some media detection
|
||||
sleep(5)
|
||||
# Check we get the video streams
|
||||
self.standalone_check_remote_video()
|
||||
self.local_check_remote_video()
|
||||
|
||||
# hangup the call
|
||||
self.hangup_call_and_verify_feedback()
|
||||
self.local_leave_room_and_verify_feedback()
|
||||
|
||||
def tearDown(self):
|
||||
self.loop_test_servers.shutdown()
|
||||
|
@ -57,7 +57,7 @@ function onClipboardReady() {
|
||||
is(tags.length, 0, "tags are gone");
|
||||
PlacesUtils.bookmarks.removeFolderChildren(PlacesUtils.unfiledBookmarksFolderId);
|
||||
|
||||
waitForClearHistory(finish);
|
||||
PlacesTestUtils.clearHistory().then(finish);
|
||||
}
|
||||
|
||||
let tests = {
|
||||
|
@ -474,8 +474,7 @@ gTests.push({
|
||||
},
|
||||
|
||||
cleanup: function() {
|
||||
var bh = PlacesUtils.history.QueryInterface(Ci.nsIBrowserHistory);
|
||||
bh.removeAllPages();
|
||||
return PlacesTestUtils.clearHistory();
|
||||
}
|
||||
});
|
||||
|
||||
@ -498,10 +497,11 @@ function test() {
|
||||
function runNextTest() {
|
||||
// Cleanup from previous test.
|
||||
if (gCurrentTest) {
|
||||
gCurrentTest.cleanup();
|
||||
info("End of test: " + gCurrentTest.desc);
|
||||
gCurrentTest = null;
|
||||
waitForAsyncUpdates(runNextTest);
|
||||
Promise.resolve(gCurrentTest.cleanup()).then(() => {
|
||||
info("End of test: " + gCurrentTest.desc);
|
||||
gCurrentTest = null;
|
||||
waitForAsyncUpdates(runNextTest);
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,7 @@ function test() {
|
||||
testForgetThisSiteVisibility(1, function() {
|
||||
testForgetThisSiteVisibility(2, function() {
|
||||
// Cleanup
|
||||
waitForClearHistory(finish);
|
||||
PlacesTestUtils.clearHistory().then(finish);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -31,7 +31,7 @@ function test() {
|
||||
waitForExplicitFinish();
|
||||
|
||||
// Cleanup.
|
||||
waitForClearHistory(continue_test);
|
||||
PlacesTestUtils.clearHistory().then(continue_test);
|
||||
}
|
||||
|
||||
function continue_test() {
|
||||
@ -64,7 +64,7 @@ function continue_test() {
|
||||
|
||||
// Cleanup.
|
||||
toggleSidebar("viewHistorySidebar", false);
|
||||
waitForClearHistory(finish);
|
||||
PlacesTestUtils.clearHistory().then(finish);
|
||||
});
|
||||
}, true);
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ const TEST_URI = NetUtil.newURI("http://www.mozilla.org/");
|
||||
|
||||
registerCleanupFunction(function* () {
|
||||
yield PlacesUtils.bookmarks.eraseEverything();
|
||||
yield promiseClearHistory();
|
||||
yield PlacesTestUtils.clearHistory();
|
||||
});
|
||||
|
||||
add_task(function* test_date_container() {
|
||||
|
@ -52,7 +52,7 @@ function test() {
|
||||
}
|
||||
|
||||
win.close();
|
||||
waitForClearHistory(finish);
|
||||
PlacesTestUtils.clearHistory().then(finish);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -108,7 +108,7 @@ gTests.push({
|
||||
|
||||
menuNode.containerOpen = false;
|
||||
|
||||
waitForClearHistory(nextTest);
|
||||
PlacesTestUtils.clearHistory().then(nextTest);
|
||||
}
|
||||
// add a visit to browser history
|
||||
addVisits(
|
||||
|
@ -39,7 +39,7 @@ function test() {
|
||||
// Close Library window.
|
||||
organizer.close();
|
||||
// Clean up history.
|
||||
waitForClearHistory(finish);
|
||||
PlacesTestUtils.clearHistory().then(finish);
|
||||
}
|
||||
|
||||
waitForExplicitFinish();
|
||||
|
@ -157,7 +157,7 @@ function onLibraryAvailable() {
|
||||
// Cleanup.
|
||||
PlacesUtils.tagging.untagURI(PlacesUtils._uri(TEST_URL), ["dummyTag"]);
|
||||
PlacesUtils.bookmarks.removeFolderChildren(PlacesUtils.unfiledBookmarksFolderId);
|
||||
waitForClearHistory(finish);
|
||||
PlacesTestUtils.clearHistory().then(finish);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -68,7 +68,7 @@ function test() {
|
||||
is(tree.selectedNode.itemId, -1, "The selected node is not bookmarked");
|
||||
},
|
||||
cleanup: function(aCallback) {
|
||||
waitForClearHistory(aCallback);
|
||||
PlacesTestUtils.clearHistory().then(aCallback);
|
||||
},
|
||||
sidebarName: HISTORY_SIDEBAR_ID,
|
||||
treeName: HISTORY_SIDEBAR_TREE_ID,
|
||||
@ -154,5 +154,5 @@ function test() {
|
||||
}
|
||||
|
||||
// Ensure history is clean before starting the test.
|
||||
waitForClearHistory(runNextTest);
|
||||
PlacesTestUtils.clearHistory().then(runNextTest);
|
||||
}
|
||||
|
@ -6,6 +6,8 @@ XPCOMUtils.defineLazyModuleGetter(this, "NetUtil",
|
||||
"resource://gre/modules/NetUtil.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "Promise",
|
||||
"resource://gre/modules/Promise.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "PlacesTestUtils",
|
||||
"resource://testing-common/PlacesTestUtils.jsm");
|
||||
|
||||
// We need to cache this before test runs...
|
||||
let cachedLeftPaneFolderIdGetter;
|
||||
@ -73,21 +75,6 @@ function promiseClipboard(aPopulateClipboardFn, aFlavor) {
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
/**
|
||||
* Waits for completion of a clear history operation, before
|
||||
* proceeding with aCallback.
|
||||
*
|
||||
* @param aCallback
|
||||
* Function to be called when done.
|
||||
*/
|
||||
function waitForClearHistory(aCallback) {
|
||||
Services.obs.addObserver(function observeCH(aSubject, aTopic, aData) {
|
||||
Services.obs.removeObserver(observeCH, PlacesUtils.TOPIC_EXPIRATION_FINISHED);
|
||||
aCallback();
|
||||
}, PlacesUtils.TOPIC_EXPIRATION_FINISHED, false);
|
||||
PlacesUtils.bhistory.removeAllPages();
|
||||
}
|
||||
|
||||
/**
|
||||
* Waits for all pending async statements on the default connection, before
|
||||
* proceeding with aCallback.
|
||||
@ -372,37 +359,3 @@ function promiseHistoryNotification(notification, conditionFn) {
|
||||
}, 2000);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears history asynchronously.
|
||||
*
|
||||
* @return {Promise}
|
||||
* @resolves When history has been cleared.
|
||||
* @rejects Never.
|
||||
*/
|
||||
function promiseClearHistory() {
|
||||
let promise = promiseTopicObserved(PlacesUtils.TOPIC_EXPIRATION_FINISHED);
|
||||
PlacesUtils.bhistory.removeAllPages();
|
||||
return promise;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows waiting for an observer notification once.
|
||||
*
|
||||
* @param topic
|
||||
* Notification topic to observe.
|
||||
*
|
||||
* @return {Promise}
|
||||
* @resolves The array [subject, data] from the observed notification.
|
||||
* @rejects Never.
|
||||
*/
|
||||
function promiseTopicObserved(topic)
|
||||
{
|
||||
let deferred = Promise.defer();
|
||||
info("Waiting for observer topic " + topic);
|
||||
Services.obs.addObserver(function PTO_observe(subject, topic, data) {
|
||||
Services.obs.removeObserver(PTO_observe, topic);
|
||||
deferred.resolve([subject, data]);
|
||||
}, topic, false);
|
||||
return deferred.promise;
|
||||
}
|
||||
|
@ -1,3 +1,11 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "PlacesTestUtils",
|
||||
"resource://testing-common/PlacesTestUtils.jsm");
|
||||
|
||||
/**
|
||||
* Asynchronously adds visits to a page, invoking a callback function when done.
|
||||
*
|
||||
@ -53,17 +61,3 @@ function addVisits(aPlaceInfo, aCallback) {
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears history invoking callback when done.
|
||||
*/
|
||||
function waitForClearHistory(aCallback) {
|
||||
const TOPIC_EXPIRATION_FINISHED = "places-expiration-finished";
|
||||
Services.obs.addObserver(function observer(aSubject, aTopic, aData) {
|
||||
Services.obs.removeObserver(observer, TOPIC_EXPIRATION_FINISHED);
|
||||
aCallback();
|
||||
}, TOPIC_EXPIRATION_FINISHED, false);
|
||||
Cc["@mozilla.org/browser/nav-history-service;1"]
|
||||
.getService(Ci.nsINavHistoryService)
|
||||
.QueryInterface(Ci.nsIBrowserHistory).removeAllPages();
|
||||
}
|
||||
|
@ -45,7 +45,7 @@
|
||||
|
||||
function runTest() {
|
||||
// The mochitest page is added to history.
|
||||
waitForClearHistory(continue_test);
|
||||
PlacesTestUtils.clearHistory().then(continue_test);
|
||||
}
|
||||
|
||||
function continue_test() {
|
||||
@ -106,7 +106,7 @@
|
||||
}
|
||||
|
||||
// Cleanup.
|
||||
waitForClearHistory(SimpleTest.finish);
|
||||
PlacesTestUtils.clearHistory().then(SimpleTest.finish);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -48,7 +48,7 @@
|
||||
|
||||
function runTest() {
|
||||
// The mochitest page is added to history.
|
||||
waitForClearHistory(continue_test);
|
||||
PlacesTestUtils.clearHistory().then(continue_test);
|
||||
}
|
||||
|
||||
function continue_test() {
|
||||
@ -72,26 +72,9 @@
|
||||
ok(true, "No exceptions thrown");
|
||||
|
||||
// Cleanup.
|
||||
waitForClearHistory(SimpleTest.finish);
|
||||
PlacesTestUtils.clearHistory().then(SimpleTest.finish);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears history invoking callback when done.
|
||||
*/
|
||||
function waitForClearHistory(aCallback) {
|
||||
const TOPIC_EXPIRATION_FINISHED = "places-expiration-finished";
|
||||
let observer = {
|
||||
observe: function(aSubject, aTopic, aData) {
|
||||
Services.obs.removeObserver(this, TOPIC_EXPIRATION_FINISHED);
|
||||
aCallback();
|
||||
}
|
||||
};
|
||||
Services.obs.addObserver(observer, TOPIC_EXPIRATION_FINISHED, false);
|
||||
let hs = Cc["@mozilla.org/browser/nav-history-service;1"].
|
||||
getService(Ci.nsINavHistoryService);
|
||||
hs.QueryInterface(Ci.nsIBrowserHistory).removeAllPages();
|
||||
}
|
||||
|
||||
]]></script>
|
||||
</window>
|
||||
|
@ -54,7 +54,7 @@
|
||||
|
||||
function runTest() {
|
||||
// The mochitest page is added to history.
|
||||
waitForClearHistory(continue_test);
|
||||
PlacesTestUtils.clearHistory().then(continue_test);
|
||||
}
|
||||
|
||||
function continue_test() {
|
||||
@ -148,7 +148,7 @@
|
||||
}
|
||||
// Cleanup.
|
||||
bs.removeItem(itemId);
|
||||
waitForClearHistory(SimpleTest.finish);
|
||||
PlacesTestUtils.clearHistory().then(SimpleTest.finish);
|
||||
}
|
||||
|
||||
// Add a visit 1ms before midnight, a visit at midnight, and
|
||||
@ -166,23 +166,6 @@
|
||||
addVisitsCallback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears history invoking callback when done.
|
||||
*/
|
||||
function waitForClearHistory(aCallback) {
|
||||
const TOPIC_EXPIRATION_FINISHED = "places-expiration-finished";
|
||||
let observer = {
|
||||
observe: function(aSubject, aTopic, aData) {
|
||||
Services.obs.removeObserver(this, TOPIC_EXPIRATION_FINISHED);
|
||||
aCallback();
|
||||
}
|
||||
};
|
||||
Services.obs.addObserver(observer, TOPIC_EXPIRATION_FINISHED, false);
|
||||
let hs = Cc["@mozilla.org/browser/nav-history-service;1"].
|
||||
getService(Ci.nsINavHistoryService);
|
||||
hs.QueryInterface(Ci.nsIBrowserHistory).removeAllPages();
|
||||
}
|
||||
|
||||
]]>
|
||||
</script>
|
||||
</window>
|
||||
|
@ -1,7 +1,6 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
Components.utils.import("resource://gre/modules/PlacesUtils.jsm");
|
||||
Components.utils.import("resource://gre/modules/NetUtil.jsm");
|
||||
Components.utils.import("resource://gre/modules/ForgetAboutSite.jsm");
|
||||
|
||||
@ -64,7 +63,7 @@ function cleanUp() {
|
||||
|
||||
function runNextTest() {
|
||||
if (gTestIndex == tests.length) {
|
||||
waitForClearHistory(finish);
|
||||
PlacesTestUtils.clearHistory().then(finish);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -136,15 +135,3 @@ function getSiteItem(aHost) {
|
||||
return gBrowser.contentDocument.
|
||||
querySelector(".site[value='" + aHost + "']");
|
||||
}
|
||||
|
||||
// copied from toolkit/components/places/tests/head_common.js
|
||||
function waitForClearHistory(aCallback) {
|
||||
let observer = {
|
||||
observe: function(aSubject, aTopic, aData) {
|
||||
Services.obs.removeObserver(this, PlacesUtils.TOPIC_EXPIRATION_FINISHED);
|
||||
aCallback();
|
||||
}
|
||||
};
|
||||
Services.obs.addObserver(observer, PlacesUtils.TOPIC_EXPIRATION_FINISHED, false);
|
||||
PlacesUtils.bhistory.removeAllPages();
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
Components.utils.import("resource://gre/modules/PlacesUtils.jsm");
|
||||
Components.utils.import("resource://gre/modules/NetUtil.jsm");
|
||||
|
||||
const ABOUT_PERMISSIONS_SPEC = "about:permissions";
|
||||
@ -81,7 +80,7 @@ function cleanUp() {
|
||||
|
||||
function runNextTest() {
|
||||
if (gTestIndex == tests.length) {
|
||||
waitForClearHistory(finish);
|
||||
PlacesTestUtils.clearHistory().then(finish);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -275,7 +274,7 @@ var tests = [
|
||||
function test_forget_site() {
|
||||
// click "Forget About This Site" button
|
||||
gBrowser.contentDocument.getElementById("forget-site-button").doCommand();
|
||||
waitForClearHistory(function() {
|
||||
PlacesTestUtils.clearHistory().then(() => {
|
||||
is(gSiteLabel.value, "", "site label cleared");
|
||||
|
||||
let allSitesItem = gBrowser.contentDocument.getElementById("all-sites-item");
|
||||
@ -329,15 +328,3 @@ function addWindowListener(aURL, aCallback) {
|
||||
onWindowTitleChange: function(aXULWindow, aNewTitle) { }
|
||||
});
|
||||
}
|
||||
|
||||
// copied from toolkit/components/places/tests/head_common.js
|
||||
function waitForClearHistory(aCallback) {
|
||||
let observer = {
|
||||
observe: function(aSubject, aTopic, aData) {
|
||||
Services.obs.removeObserver(this, PlacesUtils.TOPIC_EXPIRATION_FINISHED);
|
||||
aCallback();
|
||||
}
|
||||
};
|
||||
Services.obs.addObserver(observer, PlacesUtils.TOPIC_EXPIRATION_FINISHED, false);
|
||||
PlacesUtils.bhistory.removeAllPages();
|
||||
}
|
||||
|
@ -1,5 +1,8 @@
|
||||
Components.utils.import("resource://gre/modules/PlacesUtils.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "PlacesTestUtils",
|
||||
"resource://testing-common/PlacesTestUtils.jsm");
|
||||
|
||||
/**
|
||||
* Asynchronously adds visits to a page, invoking a callback function when done.
|
||||
*
|
||||
|
@ -31,7 +31,7 @@ function test() {
|
||||
});
|
||||
|
||||
|
||||
waitForClearHistory(function () {
|
||||
PlacesTestUtils.clearHistory().then(() => {
|
||||
historyObserver = {
|
||||
onTitleChanged: function(aURI, aPageTitle) {
|
||||
switch (++testNumber) {
|
||||
@ -89,7 +89,7 @@ function test() {
|
||||
|
||||
function afterFirstVisitInPrivateWindow() {
|
||||
is(PlacesUtils.history.getPageTitle(TEST_URI), TITLE_2, "The title remains the same after visiting in private window");
|
||||
waitForClearHistory(finish);
|
||||
PlacesTestUtils.clearHistory().then(finish);
|
||||
}
|
||||
|
||||
function whenPageLoad(aWin, aCallback) {
|
||||
@ -107,17 +107,5 @@ function test() {
|
||||
executeSoon(function() { aCallback(aWin) });
|
||||
});
|
||||
}
|
||||
|
||||
function waitForClearHistory(aCallback) {
|
||||
let observer = {
|
||||
observe: function(aSubject, aTopic, aData) {
|
||||
Services.obs.removeObserver(this, PlacesUtils.TOPIC_EXPIRATION_FINISHED);
|
||||
aCallback();
|
||||
}
|
||||
};
|
||||
Services.obs.addObserver(observer, PlacesUtils.TOPIC_EXPIRATION_FINISHED, false);
|
||||
|
||||
PlacesUtils.bhistory.removeAllPages();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -16,11 +16,7 @@ function test() {
|
||||
// delete all cookies
|
||||
cm.removeAll();
|
||||
// delete all history items
|
||||
Services.obs.addObserver(function observeCH(aSubject, aTopic, aData) {
|
||||
Services.obs.removeObserver(observeCH, PlacesUtils.TOPIC_EXPIRATION_FINISHED);
|
||||
aCallback();
|
||||
}, PlacesUtils.TOPIC_EXPIRATION_FINISHED, false);
|
||||
PlacesUtils.bhistory.removeAllPages();
|
||||
PlacesTestUtils.clearHistory().then(aCallback);
|
||||
}
|
||||
|
||||
let testNumber = 0;
|
||||
|
@ -1,6 +1,9 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "PlacesTestUtils",
|
||||
"resource://testing-common/PlacesTestUtils.jsm");
|
||||
|
||||
function whenNewWindowLoaded(aOptions, aCallback) {
|
||||
let win = OpenBrowserWindow(aOptions);
|
||||
let gotLoad = false;
|
||||
|
@ -9,8 +9,8 @@ support-files =
|
||||
skip-if = os == "linux" || e10s # Intermittent failures, bug 951965
|
||||
[browser_UITour2.js]
|
||||
skip-if = e10s # Bug 941428 - UITour.jsm not e10s friendly
|
||||
[browser_UITour3.js]
|
||||
skip-if = os == "linux" || e10s # Linux: Bug 986760, Bug 989101; e10s: Bug 941428 - UITour.jsm not e10s friendly
|
||||
# [browser_UITour3.js] Bug 1113038
|
||||
# skip-if = os == "linux" || e10s # Linux: Bug 986760, Bug 989101; e10s: Bug 941428 - UITour.jsm not e10s friendly
|
||||
[browser_UITour_availableTargets.js]
|
||||
skip-if = e10s # Bug 941428 - UITour.jsm not e10s friendly
|
||||
[browser_UITour_detach_tab.js]
|
||||
|
211
ipc/nfc/Nfc.cpp
211
ipc/nfc/Nfc.cpp
@ -1,5 +1,5 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* vim: set sw=4 ts=8 et ft=cpp: */
|
||||
/* vim: set sw=2 ts=8 et ft=cpp: */
|
||||
/* 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/. */
|
||||
@ -22,88 +22,86 @@
|
||||
|
||||
#include "jsfriendapi.h"
|
||||
#include "mozilla/ArrayUtils.h"
|
||||
#include "mozilla/ipc/UnixSocketConnector.h"
|
||||
#include "nsThreadUtils.h" // For NS_IsMainThread.
|
||||
|
||||
using namespace mozilla::ipc;
|
||||
|
||||
namespace {
|
||||
|
||||
const char* NFC_SOCKET_NAME = "/dev/socket/nfcd";
|
||||
static const char NFC_SOCKET_NAME[] = "/dev/socket/nfcd";
|
||||
|
||||
// Network port to connect to for adb forwarded sockets when doing
|
||||
// desktop development.
|
||||
const uint32_t NFC_TEST_PORT = 6400;
|
||||
static const uint32_t NFC_TEST_PORT = 6400;
|
||||
|
||||
class SendNfcSocketDataTask : public nsRunnable
|
||||
class SendNfcSocketDataTask MOZ_FINAL : public nsRunnable
|
||||
{
|
||||
public:
|
||||
SendNfcSocketDataTask(NfcConsumer* aConsumer, UnixSocketRawData* aRawData)
|
||||
: mConsumer(aConsumer), mRawData(aRawData)
|
||||
{ }
|
||||
SendNfcSocketDataTask(NfcConsumer* aConsumer, UnixSocketRawData* aRawData)
|
||||
: mConsumer(aConsumer)
|
||||
, mRawData(aRawData)
|
||||
{ }
|
||||
|
||||
NS_IMETHOD Run()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
NS_IMETHOD Run()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
if (!mConsumer ||
|
||||
mConsumer->GetConnectionStatus() != SOCKET_CONNECTED) {
|
||||
// Probably shuting down.
|
||||
delete mRawData;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
mConsumer->SendSocketData(mRawData);
|
||||
return NS_OK;
|
||||
if (!mConsumer ||
|
||||
mConsumer->GetConnectionStatus() != SOCKET_CONNECTED) {
|
||||
// Probably shuting down.
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
mConsumer->SendSocketData(mRawData.forget());
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
private:
|
||||
NfcConsumer* mConsumer;
|
||||
UnixSocketRawData* mRawData;
|
||||
NfcConsumer* mConsumer;
|
||||
nsAutoPtr<UnixSocketRawData> mRawData;
|
||||
};
|
||||
|
||||
class NfcConnector : public mozilla::ipc::UnixSocketConnector
|
||||
class NfcConnector MOZ_FINAL : public mozilla::ipc::UnixSocketConnector
|
||||
{
|
||||
public:
|
||||
NfcConnector()
|
||||
{}
|
||||
NfcConnector()
|
||||
{ }
|
||||
|
||||
virtual ~NfcConnector()
|
||||
{}
|
||||
|
||||
virtual int Create();
|
||||
virtual bool CreateAddr(bool aIsServer,
|
||||
socklen_t& aAddrSize,
|
||||
sockaddr_any& aAddr,
|
||||
const char* aAddress);
|
||||
virtual bool SetUp(int aFd);
|
||||
virtual bool SetUpListenSocket(int aFd);
|
||||
virtual void GetSocketAddr(const sockaddr_any& aAddr,
|
||||
nsAString& aAddrStr);
|
||||
int Create() MOZ_OVERRIDE;
|
||||
bool CreateAddr(bool aIsServer,
|
||||
socklen_t& aAddrSize,
|
||||
sockaddr_any& aAddr,
|
||||
const char* aAddress) MOZ_OVERRIDE;
|
||||
bool SetUp(int aFd) MOZ_OVERRIDE;
|
||||
bool SetUpListenSocket(int aFd) MOZ_OVERRIDE;
|
||||
void GetSocketAddr(const sockaddr_any& aAddr,
|
||||
nsAString& aAddrStr) MOZ_OVERRIDE;
|
||||
};
|
||||
|
||||
int
|
||||
NfcConnector::Create()
|
||||
{
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
|
||||
int fd = -1;
|
||||
int fd = -1;
|
||||
|
||||
#if defined(MOZ_WIDGET_GONK)
|
||||
fd = socket(AF_LOCAL, SOCK_STREAM, 0);
|
||||
fd = socket(AF_LOCAL, SOCK_STREAM, 0);
|
||||
#else
|
||||
// If we can't hit a local loopback, fail later in connect.
|
||||
fd = socket(AF_INET, SOCK_STREAM, 0);
|
||||
// If we can't hit a local loopback, fail later in connect.
|
||||
fd = socket(AF_INET, SOCK_STREAM, 0);
|
||||
#endif
|
||||
|
||||
if (fd < 0) {
|
||||
NS_WARNING("Could not open nfc socket!");
|
||||
return -1;
|
||||
}
|
||||
if (fd < 0) {
|
||||
NS_WARNING("Could not open nfc socket!");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!SetUp(fd)) {
|
||||
NS_WARNING("Could not set up socket!");
|
||||
}
|
||||
return fd;
|
||||
if (!SetUp(fd)) {
|
||||
NS_WARNING("Could not set up socket!");
|
||||
}
|
||||
return fd;
|
||||
}
|
||||
|
||||
bool
|
||||
@ -112,56 +110,56 @@ NfcConnector::CreateAddr(bool aIsServer,
|
||||
sockaddr_any& aAddr,
|
||||
const char* aAddress)
|
||||
{
|
||||
// We never open nfc socket as server.
|
||||
MOZ_ASSERT(!aIsServer);
|
||||
uint32_t af;
|
||||
// We never open nfc socket as server.
|
||||
MOZ_ASSERT(!aIsServer);
|
||||
uint32_t af;
|
||||
#if defined(MOZ_WIDGET_GONK)
|
||||
af = AF_LOCAL;
|
||||
af = AF_LOCAL;
|
||||
#else
|
||||
af = AF_INET;
|
||||
af = AF_INET;
|
||||
#endif
|
||||
switch (af) {
|
||||
case AF_LOCAL:
|
||||
aAddr.un.sun_family = af;
|
||||
if(strlen(aAddress) > sizeof(aAddr.un.sun_path)) {
|
||||
NS_WARNING("Address too long for socket struct!");
|
||||
return false;
|
||||
}
|
||||
strcpy((char*)&aAddr.un.sun_path, aAddress);
|
||||
aAddrSize = strlen(aAddress) + offsetof(struct sockaddr_un, sun_path) + 1;
|
||||
break;
|
||||
case AF_INET:
|
||||
aAddr.in.sin_family = af;
|
||||
aAddr.in.sin_port = htons(NFC_TEST_PORT);
|
||||
aAddr.in.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
|
||||
aAddrSize = sizeof(sockaddr_in);
|
||||
break;
|
||||
default:
|
||||
NS_WARNING("Socket type not handled by connector!");
|
||||
return false;
|
||||
switch (af) {
|
||||
case AF_LOCAL:
|
||||
aAddr.un.sun_family = af;
|
||||
if(strlen(aAddress) > sizeof(aAddr.un.sun_path)) {
|
||||
NS_WARNING("Address too long for socket struct!");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
strcpy((char*)&aAddr.un.sun_path, aAddress);
|
||||
aAddrSize = strlen(aAddress) + offsetof(struct sockaddr_un, sun_path) + 1;
|
||||
break;
|
||||
case AF_INET:
|
||||
aAddr.in.sin_family = af;
|
||||
aAddr.in.sin_port = htons(NFC_TEST_PORT);
|
||||
aAddr.in.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
|
||||
aAddrSize = sizeof(sockaddr_in);
|
||||
break;
|
||||
default:
|
||||
NS_WARNING("Socket type not handled by connector!");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
NfcConnector::SetUp(int aFd)
|
||||
{
|
||||
// Nothing to do here.
|
||||
return true;
|
||||
// Nothing to do here.
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
NfcConnector::SetUpListenSocket(int aFd)
|
||||
{
|
||||
// Nothing to do here.
|
||||
return true;
|
||||
// Nothing to do here.
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
NfcConnector::GetSocketAddr(const sockaddr_any& aAddr,
|
||||
nsAString& aAddrStr)
|
||||
{
|
||||
MOZ_CRASH("This should never be called!");
|
||||
MOZ_CRASH("This should never be called!");
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
@ -170,66 +168,71 @@ namespace mozilla {
|
||||
namespace ipc {
|
||||
|
||||
NfcConsumer::NfcConsumer(NfcSocketListener* aListener)
|
||||
: mListener(aListener)
|
||||
, mShutdown(false)
|
||||
: mListener(aListener)
|
||||
, mShutdown(false)
|
||||
{
|
||||
mAddress = NFC_SOCKET_NAME;
|
||||
mAddress = NFC_SOCKET_NAME;
|
||||
|
||||
ConnectSocket(new NfcConnector(), mAddress.get());
|
||||
Connect(new NfcConnector(), mAddress.get());
|
||||
}
|
||||
|
||||
void
|
||||
NfcConsumer::Shutdown()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
mShutdown = true;
|
||||
CloseSocket();
|
||||
mShutdown = true;
|
||||
Close();
|
||||
}
|
||||
|
||||
bool
|
||||
NfcConsumer::PostToNfcDaemon(const uint8_t* aData, size_t aSize)
|
||||
{
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
|
||||
UnixSocketRawData* raw = new UnixSocketRawData(aData, aSize);
|
||||
nsRefPtr<SendNfcSocketDataTask> task = new SendNfcSocketDataTask(this, raw);
|
||||
NS_DispatchToMainThread(task);
|
||||
return true;
|
||||
UnixSocketRawData* raw = new UnixSocketRawData(aData, aSize);
|
||||
nsRefPtr<SendNfcSocketDataTask> task = new SendNfcSocketDataTask(this, raw);
|
||||
NS_DispatchToMainThread(task);
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
NfcConsumer::ReceiveSocketData(nsAutoPtr<UnixSocketRawData>& aData)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
if (mListener) {
|
||||
mListener->ReceiveSocketData(aData);
|
||||
}
|
||||
if (mListener) {
|
||||
mListener->ReceiveSocketData(aData);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
NfcConsumer::OnConnectSuccess()
|
||||
{
|
||||
// Nothing to do here.
|
||||
CHROMIUM_LOG("NFC: %s\n", __FUNCTION__);
|
||||
// Nothing to do here.
|
||||
CHROMIUM_LOG("NFC: %s\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
void
|
||||
NfcConsumer::OnConnectError()
|
||||
{
|
||||
CHROMIUM_LOG("NFC: %s\n", __FUNCTION__);
|
||||
CloseSocket();
|
||||
CHROMIUM_LOG("NFC: %s\n", __FUNCTION__);
|
||||
Close();
|
||||
}
|
||||
|
||||
void
|
||||
NfcConsumer::OnDisconnect()
|
||||
{
|
||||
CHROMIUM_LOG("NFC: %s\n", __FUNCTION__);
|
||||
if (!mShutdown) {
|
||||
ConnectSocket(new NfcConnector(), mAddress.get(),
|
||||
GetSuggestedConnectDelayMs());
|
||||
}
|
||||
CHROMIUM_LOG("NFC: %s\n", __FUNCTION__);
|
||||
if (!mShutdown) {
|
||||
Connect(new NfcConnector(), mAddress.get(), GetSuggestedConnectDelayMs());
|
||||
}
|
||||
}
|
||||
|
||||
ConnectionOrientedSocketIO*
|
||||
NfcConsumer::GetIO()
|
||||
{
|
||||
return PrepareAccept(new NfcConnector());
|
||||
}
|
||||
|
||||
} // namespace ipc
|
||||
|
@ -9,7 +9,7 @@
|
||||
#ifndef mozilla_ipc_Nfc_h
|
||||
#define mozilla_ipc_Nfc_h 1
|
||||
|
||||
#include <mozilla/ipc/UnixSocket.h>
|
||||
#include <mozilla/ipc/StreamSocket.h>
|
||||
|
||||
namespace mozilla {
|
||||
namespace ipc {
|
||||
@ -20,21 +20,23 @@ public:
|
||||
virtual void ReceiveSocketData(nsAutoPtr<UnixSocketRawData>& aData) = 0;
|
||||
};
|
||||
|
||||
class NfcConsumer : public mozilla::ipc::UnixSocketConsumer
|
||||
class NfcConsumer MOZ_FINAL : public mozilla::ipc::StreamSocket
|
||||
{
|
||||
public:
|
||||
NfcConsumer(NfcSocketListener* aListener);
|
||||
virtual ~NfcConsumer() { }
|
||||
|
||||
void Shutdown();
|
||||
bool PostToNfcDaemon(const uint8_t* aData, size_t aSize);
|
||||
|
||||
private:
|
||||
virtual void ReceiveSocketData(nsAutoPtr<UnixSocketRawData>& aData);
|
||||
ConnectionOrientedSocketIO* GetIO() MOZ_OVERRIDE;
|
||||
|
||||
virtual void OnConnectSuccess();
|
||||
virtual void OnConnectError();
|
||||
virtual void OnDisconnect();
|
||||
private:
|
||||
void ReceiveSocketData(
|
||||
nsAutoPtr<UnixSocketRawData>& aData) MOZ_OVERRIDE;
|
||||
|
||||
void OnConnectSuccess() MOZ_OVERRIDE;
|
||||
void OnConnectError() MOZ_OVERRIDE;
|
||||
void OnDisconnect() MOZ_OVERRIDE;
|
||||
|
||||
private:
|
||||
NfcSocketListener* mListener;
|
||||
|
@ -418,6 +418,7 @@ gbjar.sources += [
|
||||
'tabs/TabHistoryFragment.java',
|
||||
'tabs/TabHistoryItemRow.java',
|
||||
'tabs/TabHistoryPage.java',
|
||||
'tabs/TabPanelBackButton.java',
|
||||
'tabs/TabsGridLayout.java',
|
||||
'tabs/TabsLayoutAdapter.java',
|
||||
'tabs/TabsLayoutItemView.java',
|
||||
|
@ -3,12 +3,15 @@
|
||||
- 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/. -->
|
||||
|
||||
<ImageButton xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/nav_back"
|
||||
android:layout_width="@dimen/tabs_panel_indicator_width"
|
||||
android:layout_height="match_parent"
|
||||
android:minWidth="@dimen/tabs_panel_indicator_width"
|
||||
android:src="@drawable/new_tablet_nav_back"
|
||||
android:contentDescription="@string/back"
|
||||
android:background="@drawable/action_bar_button_inverse"/>
|
||||
<org.mozilla.gecko.tabs.TabPanelBackButton xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:gecko="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/nav_back"
|
||||
android:layout_width="@dimen/tabs_panel_indicator_width"
|
||||
android:layout_height="match_parent"
|
||||
android:minWidth="@dimen/tabs_panel_indicator_width"
|
||||
android:src="@drawable/new_tablet_nav_back"
|
||||
android:contentDescription="@string/back"
|
||||
android:background="@drawable/action_bar_button_inverse"
|
||||
gecko:dividerVerticalPadding="@dimen/new_tablet_tab_panel_divider_vertical_padding"
|
||||
gecko:rightDivider="@drawable/tab_indicator_divider"/>
|
||||
|
||||
|
@ -28,6 +28,7 @@
|
||||
android:layout_height="match_parent"
|
||||
android:tabStripEnabled="false"
|
||||
android:divider="@drawable/tab_indicator_divider"
|
||||
android:dividerPadding="@dimen/new_tablet_tab_panel_divider_vertical_padding"
|
||||
android:layout="@layout/tabs_panel_indicator"/>
|
||||
|
||||
<View android:layout_width="0dip"
|
||||
|
@ -180,6 +180,11 @@
|
||||
<attr name="strip" format="reference"/>
|
||||
</declare-styleable>
|
||||
|
||||
<declare-styleable name="TabPanelBackButton">
|
||||
<attr name="rightDivider" format="reference"/>
|
||||
<attr name="dividerVerticalPadding" format="dimension"/>
|
||||
</declare-styleable>
|
||||
|
||||
<declare-styleable name="EllipsisTextView">
|
||||
<attr name="ellipsizeAtLine" format="integer"/>
|
||||
</declare-styleable>
|
||||
|
@ -22,6 +22,10 @@
|
||||
<dimen name="new_tablet_nav_button_width_half">21dp</dimen>
|
||||
<dimen name="new_tablet_nav_button_width_plus_half">63dp</dimen>
|
||||
|
||||
<!-- This is the system default for the vertical padding for the divider of the TabWidget.
|
||||
Used to mimic the divider padding on the tablet tabs panel back button. -->
|
||||
<dimen name="new_tablet_tab_panel_divider_vertical_padding">12dp</dimen>
|
||||
|
||||
<dimen name="new_tablet_tab_strip_height">48dp</dimen>
|
||||
<dimen name="new_tablet_tab_strip_item_width">208dp</dimen>
|
||||
<dimen name="new_tablet_tab_strip_item_margin">-28dp</dimen>
|
||||
|
55
mobile/android/base/tabs/TabPanelBackButton.java
Normal file
55
mobile/android/base/tabs/TabPanelBackButton.java
Normal file
@ -0,0 +1,55 @@
|
||||
/* 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/. */
|
||||
|
||||
package org.mozilla.gecko.tabs;
|
||||
|
||||
import org.mozilla.gecko.R;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageButton;
|
||||
|
||||
public class TabPanelBackButton extends ImageButton {
|
||||
|
||||
private int dividerWidth = 0;
|
||||
|
||||
private final Drawable divider;
|
||||
private final int dividerPadding;
|
||||
|
||||
public TabPanelBackButton(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
|
||||
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.TabPanelBackButton);
|
||||
divider = a.getDrawable(R.styleable.TabPanelBackButton_rightDivider);
|
||||
dividerPadding = (int) a.getDimension(R.styleable.TabPanelBackButton_dividerVerticalPadding, 0);
|
||||
a.recycle();
|
||||
|
||||
if (divider != null) {
|
||||
dividerWidth = divider.getIntrinsicWidth();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
||||
setMeasuredDimension(getMeasuredWidth() + dividerWidth, getMeasuredHeight());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
super.onDraw(canvas);
|
||||
if (divider != null) {
|
||||
final ViewGroup.MarginLayoutParams lp = (ViewGroup.MarginLayoutParams) getLayoutParams();
|
||||
final int left = getRight() - lp.rightMargin - dividerWidth;
|
||||
|
||||
divider.setBounds(left, getPaddingTop() + dividerPadding,
|
||||
left + dividerWidth, getHeight() - getPaddingBottom() - dividerPadding);
|
||||
divider.draw(canvas);
|
||||
}
|
||||
}
|
||||
}
|
@ -2116,7 +2116,7 @@ add_task(function test_history()
|
||||
mustInterruptResponses();
|
||||
|
||||
// We will wait for the visit to be notified during the download.
|
||||
yield promiseClearHistory();
|
||||
yield PlacesTestUtils.clearHistory();
|
||||
let promiseVisit = promiseWaitForVisit(httpUrl("interruptible.txt"));
|
||||
|
||||
// Start a download that is not allowed to finish yet.
|
||||
@ -2128,7 +2128,7 @@ add_task(function test_history()
|
||||
do_check_eq(transitionType, Ci.nsINavHistoryService.TRANSITION_DOWNLOAD);
|
||||
|
||||
// Restart and complete the download after clearing history.
|
||||
yield promiseClearHistory();
|
||||
yield PlacesTestUtils.clearHistory();
|
||||
download.cancel();
|
||||
continueResponses();
|
||||
yield download.start();
|
||||
@ -2144,7 +2144,7 @@ add_task(function test_history()
|
||||
add_task(function test_history_tryToKeepPartialData()
|
||||
{
|
||||
// We will wait for the visit to be notified during the download.
|
||||
yield promiseClearHistory();
|
||||
yield PlacesTestUtils.clearHistory();
|
||||
let promiseVisit =
|
||||
promiseWaitForVisit(httpUrl("interruptible_resumable.txt"));
|
||||
|
||||
|
@ -31,6 +31,8 @@ XPCOMUtils.defineLazyModuleGetter(this, "HttpServer",
|
||||
"resource://testing-common/httpd.js");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "NetUtil",
|
||||
"resource://gre/modules/NetUtil.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "PlacesTestUtils",
|
||||
"resource://testing-common/PlacesTestUtils.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils",
|
||||
"resource://gre/modules/PlacesUtils.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "Promise",
|
||||
@ -169,43 +171,6 @@ function promiseTimeout(aTime)
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows waiting for an observer notification once.
|
||||
*
|
||||
* @param aTopic
|
||||
* Notification topic to observe.
|
||||
*
|
||||
* @return {Promise}
|
||||
* @resolves The array [aSubject, aData] from the observed notification.
|
||||
* @rejects Never.
|
||||
*/
|
||||
function promiseTopicObserved(aTopic)
|
||||
{
|
||||
let deferred = Promise.defer();
|
||||
|
||||
Services.obs.addObserver(
|
||||
function PTO_observe(aSubject, aTopic, aData) {
|
||||
Services.obs.removeObserver(PTO_observe, aTopic);
|
||||
deferred.resolve([aSubject, aData]);
|
||||
}, aTopic, false);
|
||||
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears history asynchronously.
|
||||
*
|
||||
* @return {Promise}
|
||||
* @resolves When history has been cleared.
|
||||
* @rejects Never.
|
||||
*/
|
||||
function promiseClearHistory()
|
||||
{
|
||||
let promise = promiseTopicObserved(PlacesUtils.TOPIC_EXPIRATION_FINISHED);
|
||||
do_execute_soon(function() PlacesUtils.bhistory.removeAllPages());
|
||||
return promise;
|
||||
}
|
||||
|
||||
/**
|
||||
* Waits for a new history visit to be notified for the specified URI.
|
||||
*
|
||||
|
@ -353,7 +353,7 @@ add_task(function test_history_expiration()
|
||||
|
||||
// We must replace the visits added while executing the downloads with visits
|
||||
// that are older than 7 days, otherwise they will not be expired.
|
||||
yield promiseClearHistory();
|
||||
yield PlacesTestUtils.clearHistory();
|
||||
yield promiseExpirableDownloadVisit();
|
||||
yield promiseExpirableDownloadVisit(httpUrl("interruptible.txt"));
|
||||
|
||||
@ -396,7 +396,7 @@ add_task(function test_history_clear()
|
||||
yield downloadOne.start();
|
||||
yield downloadTwo.start();
|
||||
|
||||
yield promiseClearHistory();
|
||||
yield PlacesTestUtils.clearHistory();
|
||||
|
||||
// Wait for the removal notifications that may still be pending.
|
||||
yield deferred.promise;
|
||||
|
@ -7,6 +7,7 @@ this.EXPORTED_SYMBOLS = [
|
||||
const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
|
||||
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils",
|
||||
"resource://gre/modules/PlacesUtils.jsm");
|
||||
@ -73,4 +74,22 @@ this.PlacesTestUtils = Object.freeze({
|
||||
);
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Clear all history.
|
||||
*
|
||||
* @return {Promise}
|
||||
* @resolves When history was cleared successfully.
|
||||
* @rejects JavaScript exception.
|
||||
*/
|
||||
clearHistory() {
|
||||
let expirationFinished = new Promise(resolve => {
|
||||
Services.obs.addObserver(function observe(subj, topic, data) {
|
||||
Services.obs.removeObserver(observe, topic);
|
||||
resolve();
|
||||
}, PlacesUtils.TOPIC_EXPIRATION_FINISHED, false);
|
||||
});
|
||||
|
||||
return Promise.all([expirationFinished, PlacesUtils.history.clear()]);
|
||||
}
|
||||
});
|
||||
|
@ -27,7 +27,7 @@ add_task(function () {
|
||||
});
|
||||
});
|
||||
|
||||
yield promiseClearHistory();
|
||||
yield PlacesTestUtils.clearHistory();
|
||||
|
||||
// Ensure we wait for the default bookmarks import.
|
||||
let bookmarksDeferred = Promise.defer();
|
||||
|
@ -47,7 +47,7 @@ function test() {
|
||||
is(historyObserver.visitCount[aURI], 1,
|
||||
"onVisit has been received right number of times for " + aURI);
|
||||
}
|
||||
promiseClearHistory().then(finish);
|
||||
PlacesTestUtils.clearHistory().then(finish);
|
||||
}
|
||||
|
||||
var loadCount = 0;
|
||||
|
@ -98,7 +98,7 @@ function reloadListener() {
|
||||
|
||||
function reloadAsyncListener(aURI, aIsVisited) {
|
||||
ok(kUniqueURI.equals(aURI) && aIsVisited, "We have visited the URI.");
|
||||
promiseClearHistory().then(finish);
|
||||
PlacesTestUtils.clearHistory().then(finish);
|
||||
}
|
||||
|
||||
registerCleanupFunction(function() {
|
||||
|
@ -26,7 +26,7 @@ function test() {
|
||||
is(aHidden, 0, "Page should not be hidden");
|
||||
fieldForUrl(aURI, "typed", function (aTyped) {
|
||||
is(aTyped, 0, "page should not be marked as typed");
|
||||
promiseClearHistory().then(finish);
|
||||
PlacesTestUtils.clearHistory().then(finish);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -43,7 +43,7 @@ function test() {
|
||||
fieldForUrl(TARGET_URI, "hidden", function (aHidden) {
|
||||
is(aHidden, 0, "The target page should not be hidden");
|
||||
|
||||
promiseClearHistory().then(finish);
|
||||
PlacesTestUtils.clearHistory().then(finish);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -8,7 +8,7 @@ gBrowser.selectedTab = gBrowser.addTab();
|
||||
function finishAndCleanUp()
|
||||
{
|
||||
gBrowser.removeCurrentTab();
|
||||
promiseClearHistory().then(finish);
|
||||
PlacesTestUtils.clearHistory().then(finish);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -41,7 +41,7 @@ function continueTest(aOldFrecency) {
|
||||
is(aHidden, 0, "Page should not be hidden");
|
||||
fieldForUrl(aURI, "typed", function (aTyped) {
|
||||
is(aTyped, 0, "page should not be marked as typed");
|
||||
promiseClearHistory().then(finish);
|
||||
PlacesTestUtils.clearHistory().then(finish);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -8,7 +8,7 @@ gBrowser.selectedTab = gBrowser.addTab();
|
||||
function finishAndCleanUp()
|
||||
{
|
||||
gBrowser.removeCurrentTab();
|
||||
promiseClearHistory().then(finish);
|
||||
PlacesTestUtils.clearHistory().then(finish);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -50,7 +50,7 @@ function test()
|
||||
if (uri.spec != FINAL_URL)
|
||||
return;
|
||||
gBrowser.removeCurrentTab();
|
||||
promiseClearHistory().then(finish);
|
||||
PlacesTestUtils.clearHistory().then(finish);
|
||||
});
|
||||
|
||||
Services.prefs.setBoolPref("places.history.enabled", false);
|
||||
|
@ -76,7 +76,7 @@ function test() {
|
||||
// then test when not on private mode
|
||||
testOnWindow({}, function(aWin) {
|
||||
doTest(false, aWin, finalURL, function () {
|
||||
promiseClearHistory().then(finish);
|
||||
PlacesTestUtils.clearHistory().then(finish);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -11,47 +11,13 @@ const TRANSITION_DOWNLOAD = Ci.nsINavHistoryService.TRANSITION_DOWNLOAD;
|
||||
|
||||
Components.utils.import("resource://gre/modules/NetUtil.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "PlacesTestUtils",
|
||||
"resource://testing-common/PlacesTestUtils.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "Promise",
|
||||
"resource://gre/modules/Promise.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "Task",
|
||||
"resource://gre/modules/Task.jsm");
|
||||
|
||||
/**
|
||||
* Allows waiting for an observer notification once.
|
||||
*
|
||||
* @param aTopic
|
||||
* Notification topic to observe.
|
||||
*
|
||||
* @return {Promise}
|
||||
* @resolves The array [aSubject, aData] from the observed notification.
|
||||
* @rejects Never.
|
||||
*/
|
||||
function promiseTopicObserved(aTopic)
|
||||
{
|
||||
let deferred = Promise.defer();
|
||||
|
||||
Services.obs.addObserver(
|
||||
function PTO_observe(aSubject, aTopic, aData) {
|
||||
Services.obs.removeObserver(PTO_observe, aTopic);
|
||||
deferred.resolve([aSubject, aData]);
|
||||
}, aTopic, false);
|
||||
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears history asynchronously.
|
||||
*
|
||||
* @return {Promise}
|
||||
* @resolves When history has been cleared.
|
||||
* @rejects Never.
|
||||
*/
|
||||
function promiseClearHistory() {
|
||||
let promise = promiseTopicObserved(PlacesUtils.TOPIC_EXPIRATION_FINISHED);
|
||||
PlacesUtils.bhistory.removeAllPages();
|
||||
return promise;
|
||||
}
|
||||
|
||||
/**
|
||||
* Waits for all pending async statements on the default connection.
|
||||
*
|
||||
|
@ -7,7 +7,7 @@
|
||||
/**
|
||||
* What this is aimed to test:
|
||||
*
|
||||
* bh.removeAllPages should expire everything but bookmarked pages and valid
|
||||
* History.clear() should expire everything but bookmarked pages and valid
|
||||
* annos.
|
||||
*/
|
||||
|
||||
@ -82,7 +82,7 @@ function run_test() {
|
||||
run_next_test();
|
||||
}
|
||||
|
||||
add_task(function test_removeAllPages() {
|
||||
add_task(function test_historyClear() {
|
||||
// Set interval to a large value so we don't expire on it.
|
||||
setInterval(3600); // 1h
|
||||
|
||||
@ -125,13 +125,8 @@ add_task(function test_removeAllPages() {
|
||||
add_old_anno(pageURI, "expire_months", "test", as.EXPIRE_MONTHS, 181);
|
||||
}
|
||||
|
||||
// Expire all visits for the bookmarks. This does the same thing as the
|
||||
// promiseClearHistory helper, but it is made explicit here because
|
||||
// removeAllPages is the function we are testing.
|
||||
let promise =
|
||||
promiseTopicObserved(PlacesUtils.TOPIC_EXPIRATION_FINISHED);
|
||||
hs.QueryInterface(Ci.nsIBrowserHistory).removeAllPages();
|
||||
yield promise;
|
||||
// Expire all visits for the bookmarks
|
||||
yield PlacesUtils.history.clear();
|
||||
|
||||
["expire_days", "expire_weeks", "expire_months", "expire_session",
|
||||
"expire"].forEach(function(aAnno) {
|
@ -32,7 +32,7 @@ add_task(function test_expire_orphans()
|
||||
do_check_false(page_in_database("http://page3.mozilla.org/"));
|
||||
|
||||
// Clean up.
|
||||
yield promiseClearHistory();
|
||||
yield PlacesTestUtils.clearHistory();
|
||||
});
|
||||
|
||||
add_task(function test_expire_orphans_optionalarg()
|
||||
@ -57,7 +57,7 @@ add_task(function test_expire_orphans_optionalarg()
|
||||
do_check_false(page_in_database("http://page3.mozilla.org/"));
|
||||
|
||||
// Clean up.
|
||||
yield promiseClearHistory();
|
||||
yield PlacesTestUtils.clearHistory();
|
||||
});
|
||||
|
||||
add_task(function test_expire_limited()
|
||||
@ -77,7 +77,7 @@ add_task(function test_expire_limited()
|
||||
do_check_eq(visits_in_database("http://page2.mozilla.org/"), 1);
|
||||
|
||||
// Clean up.
|
||||
yield promiseClearHistory();
|
||||
yield PlacesTestUtils.clearHistory();
|
||||
});
|
||||
|
||||
add_task(function test_expire_unlimited()
|
||||
@ -97,7 +97,7 @@ add_task(function test_expire_unlimited()
|
||||
do_check_false(page_in_database("http://page2.mozilla.org/"));
|
||||
|
||||
// Clean up.
|
||||
yield promiseClearHistory();
|
||||
yield PlacesTestUtils.clearHistory();
|
||||
});
|
||||
|
||||
function run_test()
|
||||
|
@ -12,8 +12,6 @@
|
||||
|
||||
let os = Cc["@mozilla.org/observer-service;1"].
|
||||
getService(Ci.nsIObserverService);
|
||||
let hs = Cc["@mozilla.org/browser/nav-history-service;1"].
|
||||
getService(Ci.nsINavHistoryService);
|
||||
|
||||
let gObserver = {
|
||||
notifications: 0,
|
||||
@ -27,7 +25,7 @@ function run_test() {
|
||||
// Set interval to a large value so we don't expire on it.
|
||||
setInterval(3600); // 1h
|
||||
|
||||
hs.QueryInterface(Ci.nsIBrowserHistory).removeAllPages();
|
||||
PlacesTestUtils.clearHistory();
|
||||
|
||||
do_timeout(2000, check_result);
|
||||
do_test_pending();
|
||||
|
@ -104,10 +104,10 @@ add_task(function test_notifications_onDeleteURI() {
|
||||
|
||||
// Clean up.
|
||||
bs.removeFolderChildren(bs.unfiledBookmarksFolder);
|
||||
yield promiseClearHistory();
|
||||
yield PlacesTestUtils.clearHistory();
|
||||
}
|
||||
|
||||
clearMaxPages();
|
||||
bs.removeFolderChildren(bs.unfiledBookmarksFolder);
|
||||
yield promiseClearHistory();
|
||||
yield PlacesTestUtils.clearHistory();
|
||||
});
|
||||
|
@ -126,10 +126,10 @@ add_task(function test_notifications_onDeleteVisits() {
|
||||
|
||||
// Clean up.
|
||||
bs.removeFolderChildren(bs.unfiledBookmarksFolder);
|
||||
yield promiseClearHistory();
|
||||
yield PlacesTestUtils.clearHistory();
|
||||
}
|
||||
|
||||
clearMaxPages();
|
||||
bs.removeFolderChildren(bs.unfiledBookmarksFolder);
|
||||
yield promiseClearHistory();
|
||||
yield PlacesTestUtils.clearHistory();
|
||||
});
|
||||
|
@ -116,9 +116,9 @@ add_task(function test_pref_maxpages() {
|
||||
currentTest.expectedNotifications);
|
||||
|
||||
// Clean up.
|
||||
yield promiseClearHistory();
|
||||
yield PlacesTestUtils.clearHistory();
|
||||
}
|
||||
|
||||
clearMaxPages();
|
||||
yield promiseClearHistory();
|
||||
yield PlacesTestUtils.clearHistory();
|
||||
});
|
||||
|
@ -10,6 +10,7 @@ skip-if = os == "android"
|
||||
[test_annos_expire_never.js]
|
||||
[test_annos_expire_policy.js]
|
||||
[test_annos_expire_session.js]
|
||||
[test_clearHistory.js]
|
||||
[test_debug_expiration.js]
|
||||
[test_idle_daily.js]
|
||||
[test_notifications.js]
|
||||
@ -20,4 +21,3 @@ skip-if = os == "android"
|
||||
# Crashes when timer is used on non-main thread due to JS implemetation in this test
|
||||
skip-if = "JS implementation of nsITimer"
|
||||
[test_pref_maxpages.js]
|
||||
[test_removeAllPages.js]
|
||||
|
@ -83,7 +83,7 @@ add_task(function test_replaceFaviconData_validHistoryURI() {
|
||||
});
|
||||
yield deferSetAndFetchFavicon.promise;
|
||||
|
||||
yield promiseClearHistory();
|
||||
yield PlacesTestUtils.clearHistory();
|
||||
});
|
||||
|
||||
add_task(function test_replaceFaviconData_overrideDefaultFavicon() {
|
||||
@ -115,7 +115,7 @@ add_task(function test_replaceFaviconData_overrideDefaultFavicon() {
|
||||
});
|
||||
yield deferSetAndFetchFavicon.promise;
|
||||
|
||||
yield promiseClearHistory();
|
||||
yield PlacesTestUtils.clearHistory();
|
||||
});
|
||||
|
||||
add_task(function test_replaceFaviconData_replaceExisting() {
|
||||
@ -152,7 +152,7 @@ add_task(function test_replaceFaviconData_replaceExisting() {
|
||||
});
|
||||
yield deferSetAndFetchFavicon.promise;
|
||||
|
||||
yield promiseClearHistory();
|
||||
yield PlacesTestUtils.clearHistory();
|
||||
});
|
||||
|
||||
add_task(function test_replaceFaviconData_unrelatedReplace() {
|
||||
@ -184,7 +184,7 @@ add_task(function test_replaceFaviconData_unrelatedReplace() {
|
||||
});
|
||||
yield deferSetAndFetchFavicon.promise;
|
||||
|
||||
yield promiseClearHistory();
|
||||
yield PlacesTestUtils.clearHistory();
|
||||
});
|
||||
|
||||
add_task(function test_replaceFaviconData_badInputs() {
|
||||
@ -224,7 +224,7 @@ add_task(function test_replaceFaviconData_badInputs() {
|
||||
|
||||
favicon.file.remove(false);
|
||||
|
||||
yield promiseClearHistory();
|
||||
yield PlacesTestUtils.clearHistory();
|
||||
});
|
||||
|
||||
add_task(function test_replaceFaviconData_twiceReplace() {
|
||||
@ -259,5 +259,5 @@ add_task(function test_replaceFaviconData_twiceReplace() {
|
||||
});
|
||||
yield deferSetAndFetchFavicon.promise;
|
||||
|
||||
yield promiseClearHistory();
|
||||
yield PlacesTestUtils.clearHistory();
|
||||
});
|
||||
|
@ -85,7 +85,7 @@ add_task(function test_replaceFaviconDataFromDataURL_validHistoryURI() {
|
||||
});
|
||||
yield deferSetAndFetchFavicon.promise;
|
||||
|
||||
yield promiseClearHistory();
|
||||
yield PlacesTestUtils.clearHistory();
|
||||
});
|
||||
|
||||
add_task(function test_replaceFaviconDataFromDataURL_overrideDefaultFavicon() {
|
||||
@ -115,7 +115,7 @@ add_task(function test_replaceFaviconDataFromDataURL_overrideDefaultFavicon() {
|
||||
});
|
||||
yield deferSetAndFetchFavicon.promise;
|
||||
|
||||
yield promiseClearHistory();
|
||||
yield PlacesTestUtils.clearHistory();
|
||||
});
|
||||
|
||||
add_task(function test_replaceFaviconDataFromDataURL_replaceExisting() {
|
||||
@ -148,7 +148,7 @@ add_task(function test_replaceFaviconDataFromDataURL_replaceExisting() {
|
||||
});
|
||||
yield deferSetAndFetchFavicon.promise;
|
||||
|
||||
yield promiseClearHistory();
|
||||
yield PlacesTestUtils.clearHistory();
|
||||
});
|
||||
|
||||
add_task(function test_replaceFaviconDataFromDataURL_unrelatedReplace() {
|
||||
@ -178,7 +178,7 @@ add_task(function test_replaceFaviconDataFromDataURL_unrelatedReplace() {
|
||||
});
|
||||
yield deferSetAndFetchFavicon.promise;
|
||||
|
||||
yield promiseClearHistory();
|
||||
yield PlacesTestUtils.clearHistory();
|
||||
});
|
||||
|
||||
add_task(function test_replaceFaviconDataFromDataURL_badInputs() {
|
||||
@ -206,7 +206,7 @@ add_task(function test_replaceFaviconDataFromDataURL_badInputs() {
|
||||
|
||||
favicon.file.remove(false);
|
||||
|
||||
yield promiseClearHistory();
|
||||
yield PlacesTestUtils.clearHistory();
|
||||
});
|
||||
|
||||
add_task(function test_replaceFaviconDataFromDataURL_twiceReplace() {
|
||||
@ -237,7 +237,7 @@ add_task(function test_replaceFaviconDataFromDataURL_twiceReplace() {
|
||||
});
|
||||
yield deferSetAndFetchFavicon.promise;
|
||||
|
||||
yield promiseClearHistory();
|
||||
yield PlacesTestUtils.clearHistory();
|
||||
});
|
||||
|
||||
add_task(function test_replaceFaviconDataFromDataURL_afterRegularAssign() {
|
||||
@ -270,7 +270,7 @@ add_task(function test_replaceFaviconDataFromDataURL_afterRegularAssign() {
|
||||
});
|
||||
yield deferSetAndFetchFavicon.promise;
|
||||
|
||||
yield promiseClearHistory();
|
||||
yield PlacesTestUtils.clearHistory();
|
||||
});
|
||||
|
||||
add_task(function test_replaceFaviconDataFromDataURL_beforeRegularAssign() {
|
||||
@ -303,7 +303,7 @@ add_task(function test_replaceFaviconDataFromDataURL_beforeRegularAssign() {
|
||||
});
|
||||
yield deferSetAndFetchFavicon.promise;
|
||||
|
||||
yield promiseClearHistory();
|
||||
yield PlacesTestUtils.clearHistory();
|
||||
});
|
||||
|
||||
/* toBase64 copied from image/test/unit/test_encoder_png.js */
|
||||
|
@ -40,6 +40,8 @@ XPCOMUtils.defineLazyModuleGetter(this, "BookmarkHTMLUtils",
|
||||
"resource://gre/modules/BookmarkHTMLUtils.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "PlacesBackups",
|
||||
"resource://gre/modules/PlacesBackups.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "PlacesTestUtils",
|
||||
"resource://testing-common/PlacesTestUtils.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "PlacesTransactions",
|
||||
"resource://gre/modules/PlacesTransactions.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "OS",
|
||||
@ -388,20 +390,6 @@ function promiseTopicObserved(aTopic)
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears history asynchronously.
|
||||
*
|
||||
* @return {Promise}
|
||||
* @resolves When history has been cleared.
|
||||
* @rejects Never.
|
||||
*/
|
||||
function promiseClearHistory() {
|
||||
let promise = promiseTopicObserved(PlacesUtils.TOPIC_EXPIRATION_FINISHED);
|
||||
do_execute_soon(function() PlacesUtils.bhistory.removeAllPages());
|
||||
return promise;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Simulates a Places shutdown.
|
||||
*/
|
||||
|
@ -130,7 +130,7 @@ add_task(function* test_remove_single() {
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
yield promiseClearHistory();
|
||||
yield PlacesTestUtils.clearHistory();
|
||||
}
|
||||
return;
|
||||
});
|
||||
@ -268,7 +268,7 @@ add_task(function* test_remove_many() {
|
||||
Assert.notEqual(page_in_database(WITNESS_URI), 0, "Witness URI is still here");
|
||||
|
||||
do_print("Cleaning up");
|
||||
yield promiseClearHistory();
|
||||
yield PlacesTestUtils.clearHistory();
|
||||
|
||||
});
|
||||
|
||||
|
@ -181,7 +181,7 @@ function add_autocomplete_test(aTestData) {
|
||||
|
||||
function waitForCleanup(aCallback) {
|
||||
remove_all_bookmarks();
|
||||
promiseClearHistory().then(aCallback);
|
||||
PlacesTestUtils.clearHistory().then(aCallback);
|
||||
}
|
||||
|
||||
function addBookmark(aBookmarkObj) {
|
||||
|
@ -68,7 +68,7 @@ add_task(function pages_query()
|
||||
}
|
||||
|
||||
root.containerOpen = false;
|
||||
yield promiseClearHistory();
|
||||
yield PlacesTestUtils.clearHistory();
|
||||
});
|
||||
|
||||
add_task(function visits_query()
|
||||
@ -95,7 +95,7 @@ add_task(function visits_query()
|
||||
}
|
||||
|
||||
root.containerOpen = false;
|
||||
yield promiseClearHistory();
|
||||
yield PlacesTestUtils.clearHistory();
|
||||
});
|
||||
|
||||
add_task(function pages_searchterm_query()
|
||||
@ -119,7 +119,7 @@ add_task(function pages_searchterm_query()
|
||||
}
|
||||
|
||||
root.containerOpen = false;
|
||||
yield promiseClearHistory();
|
||||
yield PlacesTestUtils.clearHistory();
|
||||
});
|
||||
|
||||
add_task(function visits_searchterm_query()
|
||||
@ -146,7 +146,7 @@ add_task(function visits_searchterm_query()
|
||||
}
|
||||
|
||||
root.containerOpen = false;
|
||||
yield promiseClearHistory();
|
||||
yield PlacesTestUtils.clearHistory();
|
||||
});
|
||||
|
||||
add_task(function pages_searchterm_is_title_query()
|
||||
@ -170,7 +170,7 @@ add_task(function pages_searchterm_is_title_query()
|
||||
});
|
||||
|
||||
root.containerOpen = false;
|
||||
yield promiseClearHistory();
|
||||
yield PlacesTestUtils.clearHistory();
|
||||
});
|
||||
|
||||
add_task(function visits_searchterm_is_title_query()
|
||||
@ -195,5 +195,5 @@ add_task(function visits_searchterm_is_title_query()
|
||||
});
|
||||
|
||||
root.containerOpen = false;
|
||||
yield promiseClearHistory();
|
||||
yield PlacesTestUtils.clearHistory();
|
||||
});
|
||||
|
@ -300,5 +300,5 @@ add_task(function test_redirects()
|
||||
|
||||
remove_all_bookmarks();
|
||||
|
||||
yield promiseClearHistory();
|
||||
yield PlacesTestUtils.clearHistory();
|
||||
});
|
||||
|
@ -1272,6 +1272,6 @@ add_task(function test_sorting()
|
||||
test.check_reverse();
|
||||
// Execute cleanup tasks
|
||||
remove_all_bookmarks();
|
||||
yield promiseClearHistory();
|
||||
yield PlacesTestUtils.clearHistory();
|
||||
}
|
||||
});
|
||||
|
@ -577,7 +577,7 @@ function addBookmark(aURI) {
|
||||
*/
|
||||
function task_cleanDatabase(aCallback) {
|
||||
remove_all_bookmarks();
|
||||
yield promiseClearHistory();
|
||||
yield PlacesTestUtils.clearHistory();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -32,7 +32,7 @@ function* cleanup() {
|
||||
Services.prefs.clearUserPref("browser.urlbar.suggest." + type);
|
||||
}
|
||||
remove_all_bookmarks();
|
||||
yield promiseClearHistory();
|
||||
yield PlacesTestUtils.clearHistory();
|
||||
}
|
||||
do_register_cleanup(cleanup);
|
||||
|
||||
|
@ -45,7 +45,7 @@ add_task(function test_execute()
|
||||
// get charset from bookmarked page
|
||||
do_check_eq((yield PlacesUtils.getCharsetForURI(TEST_BOOKMARKED_URI)), charset);
|
||||
|
||||
yield promiseClearHistory();
|
||||
yield PlacesTestUtils.clearHistory();
|
||||
|
||||
// ensure that charset has gone for not-bookmarked page
|
||||
do_check_neq((yield PlacesUtils.getCharsetForURI(TEST_URI)), charset);
|
||||
|
@ -34,7 +34,7 @@ add_task(function changeuri_unvisited_bookmark()
|
||||
do_check_eq(frecencyForUrl(TEST_URI), 0);
|
||||
|
||||
remove_all_bookmarks();
|
||||
yield promiseClearHistory();
|
||||
yield PlacesTestUtils.clearHistory();
|
||||
});
|
||||
|
||||
add_task(function changeuri_visited_bookmark()
|
||||
@ -64,7 +64,7 @@ add_task(function changeuri_visited_bookmark()
|
||||
do_check_neq(frecencyForUrl(TEST_URI), 0);
|
||||
|
||||
remove_all_bookmarks();
|
||||
yield promiseClearHistory();
|
||||
yield PlacesTestUtils.clearHistory();
|
||||
});
|
||||
|
||||
add_task(function changeuri_bookmark_still_bookmarked()
|
||||
@ -95,7 +95,7 @@ add_task(function changeuri_bookmark_still_bookmarked()
|
||||
do_check_neq(frecencyForUrl(TEST_URI), 0);
|
||||
|
||||
remove_all_bookmarks();
|
||||
yield promiseClearHistory();
|
||||
yield PlacesTestUtils.clearHistory();
|
||||
});
|
||||
|
||||
add_task(function changeuri_nonexistent_bookmark()
|
||||
@ -127,7 +127,7 @@ add_task(function changeuri_nonexistent_bookmark()
|
||||
tryChange(id);
|
||||
|
||||
remove_all_bookmarks();
|
||||
yield promiseClearHistory();
|
||||
yield PlacesTestUtils.clearHistory();
|
||||
});
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -373,7 +373,7 @@ add_task(function test_adaptive()
|
||||
Services.prefs.clearUserPref("browser.urlbar.suggest." + type);
|
||||
}
|
||||
|
||||
yield promiseClearHistory();
|
||||
yield PlacesTestUtils.clearHistory();
|
||||
|
||||
deferEnsureResults = Promise.defer();
|
||||
yield test();
|
||||
|
@ -89,7 +89,7 @@ function run_next_test() {
|
||||
}
|
||||
|
||||
let test = tests.shift();
|
||||
promiseClearHistory().then(function() {
|
||||
PlacesTestUtils.clearHistory().then(function() {
|
||||
remove_all_bookmarks();
|
||||
do_execute_soon(test);
|
||||
});
|
||||
|
@ -56,7 +56,7 @@ add_task(function* test_removePages() {
|
||||
|
||||
// Cleanup.
|
||||
PlacesUtils.bookmarks.removeFolderChildren(PlacesUtils.unfiledBookmarksFolderId);
|
||||
yield promiseClearHistory();
|
||||
yield PlacesTestUtils.clearHistory();
|
||||
});
|
||||
|
||||
add_task(function* test_removePagesByTimeframe() {
|
||||
@ -97,8 +97,8 @@ add_task(function* test_removePagesFromHost_keepSubdomains() {
|
||||
do_check_eq(1, PlacesUtils.history.hasHistoryEntries);
|
||||
});
|
||||
|
||||
add_task(function* test_removeAllPages() {
|
||||
PlacesUtils.bhistory.removeAllPages();
|
||||
add_task(function* test_history_clear() {
|
||||
yield PlacesTestUtils.clearHistory();
|
||||
do_check_eq(0, PlacesUtils.history.hasHistoryEntries);
|
||||
});
|
||||
|
||||
|
@ -111,7 +111,7 @@ add_test(function test_dh_addMultiRemoveDownload()
|
||||
do_check_true(aURI.equals(DOWNLOAD_URI));
|
||||
do_check_true(!!page_in_database(DOWNLOAD_URI));
|
||||
|
||||
promiseClearHistory().then(run_next_test);
|
||||
PlacesTestUtils.clearHistory().then(run_next_test);
|
||||
});
|
||||
gDownloadHistory.removeAllDownloads();
|
||||
});
|
||||
@ -134,7 +134,7 @@ add_test(function test_dh_addBookmarkRemoveDownload()
|
||||
do_check_true(aURI.equals(DOWNLOAD_URI));
|
||||
do_check_true(!!page_in_database(DOWNLOAD_URI));
|
||||
|
||||
promiseClearHistory().then(run_next_test);
|
||||
PlacesTestUtils.clearHistory().then(run_next_test);
|
||||
});
|
||||
gDownloadHistory.removeAllDownloads();
|
||||
});
|
||||
@ -156,7 +156,7 @@ add_test(function test_dh_addDownload_referrer()
|
||||
// Verify that the URI is already available in results at this time.
|
||||
do_check_true(!!page_in_database(DOWNLOAD_URI));
|
||||
|
||||
promiseClearHistory().then(run_next_test);
|
||||
PlacesTestUtils.clearHistory().then(run_next_test);
|
||||
});
|
||||
|
||||
gDownloadHistory.addDownload(DOWNLOAD_URI, REFERRER_URI, Date.now() * 1000);
|
||||
@ -185,7 +185,7 @@ add_test(function test_dh_addDownload_disabledHistory()
|
||||
do_check_true(!!page_in_database(DOWNLOAD_URI));
|
||||
do_check_false(!!page_in_database(PRIVATE_URI));
|
||||
|
||||
promiseClearHistory().then(run_next_test);
|
||||
PlacesTestUtils.clearHistory().then(run_next_test);
|
||||
});
|
||||
|
||||
Services.prefs.setBoolPref("places.history.enabled", false);
|
||||
@ -221,7 +221,7 @@ add_test(function test_dh_details()
|
||||
PlacesUtils.annotations.removeObserver(annoObserver);
|
||||
PlacesUtils.history.removeObserver(historyObserver);
|
||||
|
||||
promiseClearHistory().then(run_next_test);
|
||||
PlacesTestUtils.clearHistory().then(run_next_test);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -287,7 +287,7 @@ add_task(function test_frecency()
|
||||
prefs.setBoolPref("browser.urlbar.suggest.openpage", false);
|
||||
for (let [, test] in Iterator(tests)) {
|
||||
remove_all_bookmarks();
|
||||
yield promiseClearHistory();
|
||||
yield PlacesTestUtils.clearHistory();
|
||||
|
||||
deferEnsureResults = Promise.defer();
|
||||
yield test();
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user