diff --git a/browser/base/content/socialmarks.xml b/browser/base/content/socialmarks.xml
index 0c1b13a09cc..50bebae8201 100644
--- a/browser/base/content/socialmarks.xml
+++ b/browser/base/content/socialmarks.xml
@@ -163,7 +163,7 @@
pageData.microdata = msg.data;
this.loadPanel(pageData, target);
});
- gBrowser.selectedBrowser.messageManager.sendAsyncMessage("PageMetadata:GetMicrodata", null, target);
+ gBrowser.selectedBrowser.messageManager.sendAsyncMessage("PageMetadata:GetMicrodata", null, { target });
return;
}
this.pageData = pageData;
diff --git a/browser/base/content/sync/customize.js b/browser/base/content/sync/customize.js
index b3178036d3c..7d97cdacd4e 100644
--- a/browser/base/content/sync/customize.js
+++ b/browser/base/content/sync/customize.js
@@ -4,8 +4,31 @@
"use strict";
+Components.utils.import("resource://gre/modules/Services.jsm");
+
+addEventListener("load", function () {
+ // unhide the reading-list engine if readinglist is enabled (note this
+ // dialog is only used with FxA sync, so no special action is needed
+ // for legacy sync.)
+ if (Services.prefs.getBoolPref("browser.readinglist.enabled")) {
+ document.getElementById("readinglist-engine").removeAttribute("hidden");
+ }
+});
+
addEventListener("dialogaccept", function () {
let pane = document.getElementById("sync-customize-pane");
+ // First determine what the preference for the "global" sync enabled pref
+ // should be based on the engines selected.
+ let prefElts = pane.querySelectorAll("preferences > preference");
+ let syncEnabled = false;
+ for (let elt of prefElts) {
+ if (elt.name.startsWith("services.sync.") && elt.value) {
+ syncEnabled = true;
+ break;
+ }
+ }
+ Services.prefs.setBoolPref("services.sync.enabled", syncEnabled);
+ // and write the individual prefs.
pane.writePreferences(true);
window.arguments[0].accepted = true;
});
diff --git a/browser/base/content/sync/customize.xul b/browser/base/content/sync/customize.xul
index d95536d9ac9..705889deaab 100644
--- a/browser/base/content/sync/customize.xul
+++ b/browser/base/content/sync/customize.xul
@@ -27,6 +27,8 @@
+
+
@@ -51,6 +53,11 @@
+
diff --git a/browser/base/content/test/general/browser_getshortcutoruri.js b/browser/base/content/test/general/browser_getshortcutoruri.js
index dd47b84d4a1..83959e815fa 100644
--- a/browser/base/content/test/general/browser_getshortcutoruri.js
+++ b/browser/base/content/test/general/browser_getshortcutoruri.js
@@ -91,57 +91,54 @@ var testData = [
new keywordResult(null, null, true)]
];
-function test() {
- waitForExplicitFinish();
+add_task(function* test_getshortcutoruri() {
+ yield setupKeywords();
- setupKeywords();
+ for (let item of testData) {
+ let [data, result] = item;
- Task.spawn(function() {
- for each (var item in testData) {
- let [data, result] = item;
+ let query = data.keyword;
+ if (data.searchWord)
+ query += " " + data.searchWord;
+ let returnedData = yield new Promise(
+ resolve => getShortcutOrURIAndPostData(query, resolve));
+ // null result.url means we should expect the same query we sent in
+ let expected = result.url || query;
+ is(returnedData.url, expected, "got correct URL for " + data.keyword);
+ is(getPostDataString(returnedData.postData), result.postData, "got correct postData for " + data.keyword);
+ is(returnedData.mayInheritPrincipal, !result.isUnsafe, "got correct mayInheritPrincipal for " + data.keyword);
+ }
- let query = data.keyword;
- if (data.searchWord)
- query += " " + data.searchWord;
- let returnedData = yield new Promise(
- resolve => getShortcutOrURIAndPostData(query, resolve));
- // null result.url means we should expect the same query we sent in
- let expected = result.url || query;
- is(returnedData.url, expected, "got correct URL for " + data.keyword);
- is(getPostDataString(returnedData.postData), result.postData, "got correct postData for " + data.keyword);
- is(returnedData.mayInheritPrincipal, !result.isUnsafe, "got correct mayInheritPrincipal for " + data.keyword);
- }
- cleanupKeywords();
- }).then(finish);
-}
+ yield cleanupKeywords();
+});
-var gBMFolder = null;
-var gAddedEngines = [];
-function setupKeywords() {
- gBMFolder = Application.bookmarks.menu.addFolder("keyword-test");
- for each (var item in testData) {
- var data = item[0];
+let folder = null;
+let gAddedEngines = [];
+
+function* setupKeywords() {
+ folder = yield PlacesUtils.bookmarks.insert({ parentGuid: PlacesUtils.bookmarks.unfiledGuid,
+ type: PlacesUtils.bookmarks.TYPE_FOLDER,
+ title: "keyword-test" });
+ for (let item of testData) {
+ let data = item[0];
if (data instanceof bmKeywordData) {
- var bm = gBMFolder.addBookmark(data.keyword, data.uri);
- bm.keyword = data.keyword;
- if (data.postData)
- bm.annotations.set("bookmarkProperties/POSTData", data.postData, Ci.nsIAnnotationService.EXPIRE_SESSION);
+ yield PlacesUtils.bookmarks.insert({ url: data.uri, parentGuid: folder.guid });
+ yield PlacesUtils.keywords.insert({ keyword: data.keyword, url: data.uri.spec, postData: data.postData });
}
if (data instanceof searchKeywordData) {
Services.search.addEngineWithDetails(data.keyword, "", data.keyword, "", data.method, data.uri.spec);
- var addedEngine = Services.search.getEngineByName(data.keyword);
+ let addedEngine = Services.search.getEngineByName(data.keyword);
if (data.postData) {
- var [paramName, paramValue] = data.postData.split("=");
+ let [paramName, paramValue] = data.postData.split("=");
addedEngine.addParam(paramName, paramValue, null);
}
-
gAddedEngines.push(addedEngine);
}
}
}
-function cleanupKeywords() {
- gBMFolder.remove();
+function* cleanupKeywords() {
+ PlacesUtils.bookmarks.remove(folder);
gAddedEngines.map(Services.search.removeEngine);
}
diff --git a/browser/base/content/test/general/browser_keywordBookmarklets.js b/browser/base/content/test/general/browser_keywordBookmarklets.js
index 8b075d74cc2..434951251bd 100644
--- a/browser/base/content/test/general/browser_keywordBookmarklets.js
+++ b/browser/base/content/test/general/browser_keywordBookmarklets.js
@@ -1,38 +1,34 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
+"use strict"
-function test() {
- waitForExplicitFinish();
-
- let bmFolder = Application.bookmarks.menu.addFolder("keyword-test");
+add_task(function* test_keyword_bookmarklet() {
+ let bm = yield PlacesUtils.bookmarks.insert({ parentGuid: PlacesUtils.bookmarks.unfiledGuid,
+ title: "bookmarklet",
+ url: "javascript:1;" });
let tab = gBrowser.selectedTab = gBrowser.addTab();
-
- registerCleanupFunction (function () {
- bmFolder.remove();
+ registerCleanupFunction (function* () {
gBrowser.removeTab(tab);
+ yield PlacesUtils.bookmarks.remove(bm);
});
+ yield promisePageShow();
+ let originalPrincipal = gBrowser.contentPrincipal;
- let bm = bmFolder.addBookmark("bookmarklet", makeURI("javascript:1;"));
- bm.keyword = "bm";
+ yield PlacesUtils.keywords.insert({ keyword: "bm", url: "javascript:1;" })
- addPageShowListener(function () {
- let originalPrincipal = gBrowser.contentPrincipal;
+ // Enter bookmarklet keyword in the URL bar
+ gURLBar.value = "bm";
+ gURLBar.focus();
+ EventUtils.synthesizeKey("VK_RETURN", {});
- // Enter bookmarklet keyword in the URL bar
- gURLBar.value = "bm";
- gURLBar.focus();
- EventUtils.synthesizeKey("VK_RETURN", {});
+ yield promisePageShow();
- addPageShowListener(function () {
- ok(gBrowser.contentPrincipal.equals(originalPrincipal), "javascript bookmarklet should inherit principal");
- finish();
+ ok(gBrowser.contentPrincipal.equals(originalPrincipal), "javascript bookmarklet should inherit principal");
+});
+
+function* promisePageShow() {
+ return new Promise(resolve => {
+ gBrowser.selectedBrowser.addEventListener("pageshow", function listen() {
+ gBrowser.selectedBrowser.removeEventListener("pageshow", listen);
+ resolve();
});
});
}
-
-function addPageShowListener(func) {
- gBrowser.selectedBrowser.addEventListener("pageshow", function loadListener() {
- gBrowser.selectedBrowser.removeEventListener("pageshow", loadListener, false);
- func();
- });
-}
diff --git a/browser/base/content/test/general/browser_tab_detach_restore.js b/browser/base/content/test/general/browser_tab_detach_restore.js
index 0557c9e1566..804be0869d7 100644
--- a/browser/base/content/test/general/browser_tab_detach_restore.js
+++ b/browser/base/content/test/general/browser_tab_detach_restore.js
@@ -21,8 +21,8 @@ add_task(function*() {
is(SessionStore.getClosedWindowCount(), 1, "Should have restore data for the closed window");
win = SessionStore.undoCloseWindow(0);
- yield BrowserTestUtils.waitForEvent(win, "load", 10000);
- yield BrowserTestUtils.waitForEvent(win.gBrowser.tabs[0], "SSTabRestored", 10000);
+ yield BrowserTestUtils.waitForEvent(win, "load");
+ yield BrowserTestUtils.waitForEvent(win.gBrowser.tabs[0], "SSTabRestored");
is(win.gBrowser.tabs.length, 1, "Should have restored one tab");
is(win.gBrowser.selectedBrowser.currentURI.spec, uri, "Should have restored the right page");
diff --git a/browser/base/content/test/general/readerModeArticle.html b/browser/base/content/test/general/readerModeArticle.html
index f34cbece4e1..b533423ad66 100644
--- a/browser/base/content/test/general/readerModeArticle.html
+++ b/browser/base/content/test/general/readerModeArticle.html
@@ -11,6 +11,9 @@
by Jane Doe
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam lectus. Sed sit amet ipsum mauris. Maecenas congue ligula ac quam viverra nec consectetur ante hendrerit. Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean ut gravida lorem. Ut turpis felis, pulvinar a semper sed, adipiscing id dolor. Pellentesque auctor nisi id magna consequat sagittis. Curabitur dapibus enim sit amet elit pharetra tincidunt feugiat nisl imperdiet. Ut convallis libero in urna ultrices accumsan. Donec sed odio eros. Donec viverra mi quis quam pulvinar at malesuada arcu rhoncus. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. In rutrum accumsan ultricies. Mauris vitae nisi at sem facilisis semper ac in est.
Vivamus fermentum semper porta. Nunc diam velit, adipiscing ut tristique vitae, sagittis vel odio. Maecenas convallis ullamcorper ultricies. Curabitur ornare, ligula semper consectetur sagittis, nisi diam iaculis velit, id fringilla sem nunc vel mi. Nam dictum, odio nec pretium volutpat, arcu ante placerat erat, non tristique elit urna et turpis. Quisque mi metus, ornare sit amet fermentum et, tincidunt et orci. Fusce eget orci a orci congue vestibulum. Ut dolor diam, elementum et vestibulum eu, porttitor vel elit. Curabitur venenatis pulvinar tellus gravida ornare. Sed et erat faucibus nunc euismod ultricies ut id justo. Nullam cursus suscipit nisi, et ultrices justo sodales nec. Fusce venenatis facilisis lectus ac semper. Aliquam at massa ipsum. Quisque bibendum purus convallis nulla ultrices ultricies. Nullam aliquam, mi eu aliquam tincidunt, purus velit laoreet tortor, viverra pretium nisi quam vitae mi. Fusce vel volutpat elit. Nam sagittis nisi dui.
+Vivamus fermentum semper porta. Nunc diam velit, adipiscing ut tristique vitae, sagittis vel odio. Maecenas convallis ullamcorper ultricies. Curabitur ornare, ligula semper consectetur sagittis, nisi diam iaculis velit, id fringilla sem nunc vel mi. Nam dictum, odio nec pretium volutpat, arcu ante placerat erat, non tristique elit urna et turpis. Quisque mi metus, ornare sit amet fermentum et, tincidunt et orci. Fusce eget orci a orci congue vestibulum. Ut dolor diam, elementum et vestibulum eu, porttitor vel elit. Curabitur venenatis pulvinar tellus gravida ornare. Sed et erat faucibus nunc euismod ultricies ut id justo. Nullam cursus suscipit nisi, et ultrices justo sodales nec. Fusce venenatis facilisis lectus ac semper. Aliquam at massa ipsum. Quisque bibendum purus convallis nulla ultrices ultricies. Nullam aliquam, mi eu aliquam tincidunt, purus velit laoreet tortor, viverra pretium nisi quam vitae mi. Fusce vel volutpat elit. Nam sagittis nisi dui.
+Vivamus fermentum semper porta. Nunc diam velit, adipiscing ut tristique vitae, sagittis vel odio. Maecenas convallis ullamcorper ultricies. Curabitur ornare, ligula semper consectetur sagittis, nisi diam iaculis velit, id fringilla sem nunc vel mi. Nam dictum, odio nec pretium volutpat, arcu ante placerat erat, non tristique elit urna et turpis. Quisque mi metus, ornare sit amet fermentum et, tincidunt et orci. Fusce eget orci a orci congue vestibulum. Ut dolor diam, elementum et vestibulum eu, porttitor vel elit. Curabitur venenatis pulvinar tellus gravida ornare. Sed et erat faucibus nunc euismod ultricies ut id justo. Nullam cursus suscipit nisi, et ultrices justo sodales nec. Fusce venenatis facilisis lectus ac semper. Aliquam at massa ipsum. Quisque bibendum purus convallis nulla ultrices ultricies. Nullam aliquam, mi eu aliquam tincidunt, purus velit laoreet tortor, viverra pretium nisi quam vitae mi. Fusce vel volutpat elit. Nam sagittis nisi dui.
+Vivamus fermentum semper porta. Nunc diam velit, adipiscing ut tristique vitae, sagittis vel odio. Maecenas convallis ullamcorper ultricies. Curabitur ornare, ligula semper consectetur sagittis, nisi diam iaculis velit, id fringilla sem nunc vel mi. Nam dictum, odio nec pretium volutpat, arcu ante placerat erat, non tristique elit urna et turpis. Quisque mi metus, ornare sit amet fermentum et, tincidunt et orci. Fusce eget orci a orci congue vestibulum. Ut dolor diam, elementum et vestibulum eu, porttitor vel elit. Curabitur venenatis pulvinar tellus gravida ornare. Sed et erat faucibus nunc euismod ultricies ut id justo. Nullam cursus suscipit nisi, et ultrices justo sodales nec. Fusce venenatis facilisis lectus ac semper. Aliquam at massa ipsum. Quisque bibendum purus convallis nulla ultrices ultricies. Nullam aliquam, mi eu aliquam tincidunt, purus velit laoreet tortor, viverra pretium nisi quam vitae mi. Fusce vel volutpat elit. Nam sagittis nisi dui.