summaryrefslogtreecommitdiffstats
path: root/toolkit
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit')
-rw-r--r--toolkit/components/aboutcache/content/aboutCache.js4
-rw-r--r--toolkit/components/alerts/resources/content/alert.css1
-rw-r--r--toolkit/components/alerts/resources/content/alert.js10
-rw-r--r--toolkit/components/autocomplete/nsAutoCompleteController.cpp122
-rw-r--r--toolkit/components/autocomplete/nsAutoCompleteSimpleResult.cpp23
-rw-r--r--toolkit/components/autocomplete/nsAutoCompleteSimpleResult.h2
-rw-r--r--toolkit/components/autocomplete/nsIAutoCompleteResult.idl7
-rw-r--r--toolkit/components/autocomplete/nsIAutoCompleteSimpleResult.idl6
-rw-r--r--toolkit/components/autocomplete/tests/unit/head_autocomplete.js5
-rw-r--r--toolkit/components/autocomplete/tests/unit/test_hiddenResult.js76
-rw-r--r--toolkit/components/autocomplete/tests/unit/test_popupSelectionVsDefaultCompleteValue.js71
-rw-r--r--toolkit/components/autocomplete/tests/unit/xpcshell.ini2
-rw-r--r--toolkit/components/filepicker/nsFileView.cpp7
-rw-r--r--toolkit/components/jsdownloads/src/DownloadIntegration.jsm40
-rw-r--r--toolkit/components/moz.build3
-rw-r--r--toolkit/components/mozintl/MozIntl.cpp26
-rw-r--r--toolkit/components/mozintl/mozIMozIntl.idl1
-rw-r--r--toolkit/components/mozintl/test/test_mozintl.js14
-rw-r--r--toolkit/components/passwordmgr/content/passwordManager.js8
-rw-r--r--toolkit/components/passwordmgr/content/passwordManager.xul3
-rw-r--r--toolkit/components/passwordmgr/jar.mn2
-rw-r--r--toolkit/components/passwordmgr/nsLoginManagerPrompter.js29
-rw-r--r--toolkit/components/passwordmgr/test/unit/test_logins_search.js1
-rw-r--r--toolkit/components/places/UnifiedComplete.js2
-rw-r--r--toolkit/components/places/moz.build2
-rw-r--r--toolkit/components/places/nsNavBookmarks.cpp2
-rw-r--r--toolkit/components/places/nsNavHistory.cpp6
-rw-r--r--toolkit/components/places/nsPlacesAutoComplete.js1778
-rw-r--r--toolkit/components/places/nsPlacesAutoComplete.manifest6
-rw-r--r--toolkit/components/places/nsTaggingService.js4
-rw-r--r--toolkit/components/places/tests/cpp/places_test_harness_tail.h29
-rw-r--r--toolkit/components/protobuf/moz.build5
-rw-r--r--toolkit/components/satchel/test/test_form_autocomplete.html12
-rw-r--r--toolkit/components/telemetry/TelemetryEnvironment.jsm30
-rw-r--r--toolkit/components/terminator/nsTerminator.cpp11
-rw-r--r--toolkit/components/url-classifier/HashStore.cpp3
-rw-r--r--toolkit/components/url-classifier/nsCheckSummedOutputStream.cpp17
-rw-r--r--toolkit/components/url-classifier/nsCheckSummedOutputStream.h24
-rw-r--r--toolkit/components/webextensions/ExtensionChild.jsm28
-rw-r--r--toolkit/components/webextensions/ExtensionCommon.jsm3
-rw-r--r--toolkit/components/webextensions/ExtensionContent.jsm4
-rw-r--r--toolkit/components/webextensions/LegacyExtensionsUtils.jsm2
-rw-r--r--toolkit/components/webextensions/ext-c-runtime.js5
-rw-r--r--toolkit/components/webextensions/schemas/runtime.json2
-rw-r--r--toolkit/components/webextensions/test/mochitest/mochitest.ini1
-rw-r--r--toolkit/components/webextensions/test/mochitest/test_ext_all_apis.js2
-rw-r--r--toolkit/components/webextensions/test/mochitest/test_ext_external_messaging.html111
-rw-r--r--toolkit/components/webextensions/test/mochitest/test_ext_sendmessage_reply2.html144
-rw-r--r--toolkit/components/webextensions/test/xpcshell/test_ext_legacy_extension_context.js4
-rw-r--r--toolkit/components/xulstore/XULStore.js18
-rw-r--r--toolkit/content/about.js23
-rw-r--r--toolkit/content/about.xhtml3
-rw-r--r--toolkit/content/aboutSupport.js119
-rw-r--r--toolkit/content/aboutSupport.xhtml67
-rw-r--r--toolkit/content/browser-child.js26
-rw-r--r--toolkit/content/browser-content.js16
-rw-r--r--toolkit/content/customizeToolbar.js24
-rw-r--r--toolkit/content/datepicker.xhtml60
-rw-r--r--toolkit/content/jar.mn13
-rw-r--r--toolkit/content/license.html48
-rw-r--r--toolkit/content/logopage.xhtml36
-rw-r--r--toolkit/content/memoriam.xhtml76
-rw-r--r--toolkit/content/mozilla.css36
-rw-r--r--toolkit/content/mozilla.xhtml35
-rw-r--r--toolkit/content/plugins.html14
-rw-r--r--toolkit/content/tests/browser/browser.ini1
-rw-r--r--toolkit/content/tests/browser/browser_datetime_datepicker.js284
-rw-r--r--toolkit/content/tests/browser/head.js90
-rw-r--r--toolkit/content/timepicker.xhtml2
-rw-r--r--toolkit/content/widgets/calendar.js171
-rw-r--r--toolkit/content/widgets/datekeeper.js336
-rw-r--r--toolkit/content/widgets/datepicker.js376
-rw-r--r--toolkit/content/widgets/datetimebox.css12
-rw-r--r--toolkit/content/widgets/datetimebox.xml782
-rw-r--r--toolkit/content/widgets/datetimepicker.xml6
-rw-r--r--toolkit/content/widgets/datetimepopup.xml171
-rw-r--r--toolkit/content/widgets/findbar.xml58
-rw-r--r--toolkit/content/widgets/menulist.xml18
-rw-r--r--toolkit/content/widgets/spinner.js47
-rw-r--r--toolkit/content/widgets/timekeeper.js12
-rw-r--r--toolkit/content/widgets/timepicker.js39
-rw-r--r--toolkit/content/widgets/toolbar.xml55
-rw-r--r--toolkit/forgetaboutsite/ForgetAboutSite.jsm244
-rw-r--r--toolkit/forgetaboutsite/test/browser/browser_clearplugindata.js9
-rw-r--r--toolkit/forgetaboutsite/test/unit/test_removeDataFromDomain.js68
-rw-r--r--toolkit/jetpack/modules/system/Startup.js1
-rw-r--r--toolkit/jetpack/moz.build25
-rw-r--r--toolkit/jetpack/sdk/addon/bootstrap.js2
-rw-r--r--toolkit/jetpack/sdk/clipboard.js1
-rw-r--r--toolkit/jetpack/sdk/context-menu.js1
-rw-r--r--toolkit/jetpack/sdk/panel.js1
-rw-r--r--toolkit/jetpack/sdk/places/bookmarks.js1
-rw-r--r--toolkit/jetpack/sdk/places/events.js1
-rw-r--r--toolkit/jetpack/sdk/places/favicon.js1
-rw-r--r--toolkit/jetpack/sdk/places/history.js1
-rw-r--r--toolkit/jetpack/sdk/places/host/host-bookmarks.js1
-rw-r--r--toolkit/jetpack/sdk/places/host/host-query.js1
-rw-r--r--toolkit/jetpack/sdk/places/host/host-tags.js1
-rw-r--r--toolkit/jetpack/sdk/places/utils.js1
-rw-r--r--toolkit/jetpack/sdk/selection.js1
-rw-r--r--toolkit/jetpack/sdk/system/xul-app.jsm1
-rw-r--r--toolkit/jetpack/sdk/ui.js3
-rw-r--r--toolkit/jetpack/sdk/ui/button/action.js1
-rw-r--r--toolkit/jetpack/sdk/ui/button/toggle.js1
-rw-r--r--toolkit/jetpack/sdk/ui/button/view.js45
-rw-r--r--toolkit/jetpack/sdk/ui/button/view/events.js1
-rw-r--r--toolkit/jetpack/sdk/ui/buttons.js198
-rw-r--r--toolkit/jetpack/sdk/ui/state.js1
-rw-r--r--toolkit/jetpack/sdk/ui/state/events.js1
-rw-r--r--toolkit/locales/Makefile.in8
-rw-r--r--toolkit/locales/en-US/chrome/global/about.dtd7
-rw-r--r--toolkit/locales/en-US/chrome/global/aboutRights.dtd19
-rw-r--r--toolkit/locales/en-US/chrome/global/autocomplete.properties5
-rw-r--r--toolkit/locales/en-US/chrome/global/customizeToolbar.properties1
-rw-r--r--toolkit/locales/en-US/chrome/global/datetimebox.dtd9
-rw-r--r--toolkit/locales/en-US/chrome/global/findbar.dtd4
-rw-r--r--toolkit/locales/en-US/chrome/mozapps/preferences/changemp.dtd2
-rw-r--r--toolkit/locales/en-US/chrome/passwordmgr/passwordManager.dtd2
-rw-r--r--toolkit/locales/en-US/chrome/passwordmgr/passwordmgr.properties11
-rw-r--r--toolkit/locales/en-US/chrome/places/places.properties1
-rw-r--r--toolkit/locales/jar.mn1
-rw-r--r--toolkit/locales/l10n.mk8
-rw-r--r--toolkit/modules/AppConstants.jsm20
-rw-r--r--toolkit/modules/DateTimePickerHelper.jsm29
-rw-r--r--toolkit/modules/ResetProfile.jsm6
-rw-r--r--toolkit/modules/Services.jsm9
-rw-r--r--toolkit/modules/Troubleshoot.jsm32
-rw-r--r--toolkit/modules/addons/WebRequestContent.js10
-rw-r--r--toolkit/modules/sessionstore/FormData.jsm2
-rw-r--r--toolkit/moz.build3
-rw-r--r--toolkit/moz.configure24
-rw-r--r--toolkit/mozapps/extensions/AddonManager.jsm6
-rw-r--r--toolkit/mozapps/extensions/AddonPathService.cpp10
-rw-r--r--toolkit/mozapps/extensions/DeferredSave.jsm6
-rw-r--r--toolkit/mozapps/extensions/addonManager.js4
-rw-r--r--toolkit/mozapps/extensions/amIAddonPathService.idl8
-rw-r--r--toolkit/mozapps/extensions/amInstallTrigger.js2
-rw-r--r--toolkit/mozapps/extensions/amWebInstallListener.js2
-rw-r--r--toolkit/mozapps/extensions/content/extensions.js85
-rw-r--r--toolkit/mozapps/extensions/content/update.js4
-rw-r--r--toolkit/mozapps/extensions/internal/AddonRepository.jsm4
-rw-r--r--toolkit/mozapps/extensions/internal/AddonRepository_SQLiteMigrator.jsm8
-rw-r--r--toolkit/mozapps/extensions/internal/AddonUpdateChecker.jsm2
-rw-r--r--toolkit/mozapps/extensions/internal/Content.js4
-rw-r--r--toolkit/mozapps/extensions/internal/GMPProvider.jsm8
-rw-r--r--toolkit/mozapps/extensions/internal/LightweightThemeImageOptimizer.jsm8
-rw-r--r--toolkit/mozapps/extensions/internal/PluginProvider.jsm2
-rw-r--r--toolkit/mozapps/extensions/internal/XPIProvider.jsm72
-rw-r--r--toolkit/mozapps/extensions/internal/XPIProviderUtils.js2
-rw-r--r--toolkit/mozapps/extensions/nsBlocklistService.js2
-rw-r--r--toolkit/mozapps/extensions/test/addons/test_bootstrap_const/bootstrap.js5
-rw-r--r--toolkit/mozapps/extensions/test/addons/test_bootstrap_const/install.rdf24
-rw-r--r--toolkit/mozapps/extensions/test/browser/browser-common.ini2
-rw-r--r--toolkit/mozapps/extensions/test/browser/browser_experiments.js645
-rw-r--r--toolkit/mozapps/extensions/test/xpcshell/test_bootstrap_const.js17
-rw-r--r--toolkit/mozapps/extensions/test/xpcshell/test_mapURIToAddonID.js4
-rw-r--r--toolkit/mozapps/extensions/test/xpcshell/xpcshell-shared.ini1
-rw-r--r--toolkit/mozapps/installer/find-dupes.py115
-rw-r--r--toolkit/mozapps/installer/packager.mk2
-rw-r--r--toolkit/mozapps/preferences/changemp.js12
-rw-r--r--toolkit/mozapps/preferences/changemp.xul7
-rw-r--r--toolkit/mozapps/webextensions/content/extensions.js84
-rw-r--r--toolkit/mozapps/webextensions/internal/XPIProvider.jsm10
-rw-r--r--toolkit/mozapps/webextensions/test/browser/browser-common.ini1
-rw-r--r--toolkit/mozapps/webextensions/test/browser/browser_experiments.js654
-rw-r--r--toolkit/pluginproblem/content/pluginProblemBinding.css5
-rw-r--r--toolkit/pluginproblem/content/pluginProblemContent.css6
-rw-r--r--toolkit/pluginproblem/jar.mn4
-rw-r--r--toolkit/profile/nsProfileLock.cpp4
-rw-r--r--toolkit/themes/linux/global/findBar.css151
-rw-r--r--toolkit/themes/linux/global/icons/find.pngbin0 -> 1498 bytes
-rw-r--r--toolkit/themes/linux/global/inContentUI.css41
-rw-r--r--toolkit/themes/linux/global/jar.mn8
-rw-r--r--toolkit/themes/linux/mozapps/jar.mn49
-rw-r--r--toolkit/themes/linux/mozapps/passwordmgr/key-16.pngbin0 -> 773 bytes
-rw-r--r--toolkit/themes/linux/mozapps/passwordmgr/key-64.pngbin0 -> 6142 bytes
-rw-r--r--toolkit/themes/linux/mozapps/passwordmgr/key.pngbin0 -> 658 bytes
-rw-r--r--toolkit/themes/osx/global/findBar.css257
-rw-r--r--toolkit/themes/osx/global/inContentUI.css144
-rw-r--r--toolkit/themes/osx/global/jar.mn1
-rw-r--r--toolkit/themes/osx/mozapps/jar.mn3
-rw-r--r--toolkit/themes/osx/mozapps/passwordmgr/key-16.pngbin0 -> 773 bytes
-rw-r--r--toolkit/themes/osx/mozapps/passwordmgr/key-64.pngbin0 -> 6142 bytes
-rw-r--r--toolkit/themes/osx/mozapps/passwordmgr/key.pngbin0 -> 658 bytes
-rw-r--r--toolkit/themes/shared/about.css8
-rw-r--r--toolkit/themes/shared/datetimeinputpickers.css377
-rw-r--r--toolkit/themes/shared/datetimepopup.css11
-rw-r--r--toolkit/themes/shared/icons/calendar-arrows.svg13
-rw-r--r--toolkit/themes/shared/icons/spinner-arrows.svg13
-rw-r--r--toolkit/themes/shared/jar.inc.mn5
-rw-r--r--toolkit/themes/shared/non-mac.jar.inc.mn2
-rw-r--r--toolkit/themes/shared/timepicker.css153
-rw-r--r--toolkit/themes/windows/global/findBar.css159
-rw-r--r--toolkit/themes/windows/global/icons/find.pngbin0 -> 1736 bytes
-rw-r--r--toolkit/themes/windows/global/icons/question-32.pngbin0 -> 1962 bytes
-rw-r--r--toolkit/themes/windows/global/icons/question-48.pngbin0 -> 2851 bytes
-rw-r--r--toolkit/themes/windows/global/inContentUI.css159
-rw-r--r--toolkit/themes/windows/global/jar.mn2
-rw-r--r--toolkit/themes/windows/mozapps/jar.mn4
-rw-r--r--toolkit/themes/windows/mozapps/passwordmgr/key-16.pngbin0 -> 773 bytes
-rw-r--r--toolkit/themes/windows/mozapps/passwordmgr/key-64.pngbin0 -> 6142 bytes
-rw-r--r--toolkit/themes/windows/mozapps/passwordmgr/key.pngbin0 -> 658 bytes
-rw-r--r--toolkit/themes/windows/mozapps/plugins/pluginGeneric-16.pngbin539 -> 635 bytes
-rw-r--r--toolkit/themes/windows/mozapps/plugins/pluginGeneric-48.pngbin0 -> 2174 bytes
-rw-r--r--toolkit/themes/windows/mozapps/plugins/pluginGeneric.pngbin971 -> 1334 bytes
-rw-r--r--toolkit/toolkit.mozbuild4
-rw-r--r--toolkit/xre/MozMeegoAppService.h28
-rw-r--r--toolkit/xre/ProfileReset.cpp12
-rw-r--r--toolkit/xre/ProfileReset.h1
-rw-r--r--toolkit/xre/nsAndroidStartup.cpp9
-rw-r--r--toolkit/xre/nsAppRunner.cpp701
-rw-r--r--toolkit/xre/nsEmbedFunctions.cpp79
-rw-r--r--toolkit/xre/nsWindowsWMain.cpp4
-rw-r--r--toolkit/xre/nsX11ErrorHandler.cpp12
214 files changed, 6937 insertions, 3914 deletions
diff --git a/toolkit/components/aboutcache/content/aboutCache.js b/toolkit/components/aboutcache/content/aboutCache.js
index 07067cce3..e945d683e 100644
--- a/toolkit/components/aboutcache/content/aboutCache.js
+++ b/toolkit/components/aboutcache/content/aboutCache.js
@@ -40,5 +40,9 @@ function navigate()
if ($('priv').checked)
context += 'p,';
+ if (storage == null) {
+ storage = "";
+ }
+
window.location.href = 'about:cache?storage=' + storage + '&context=' + context;
}
diff --git a/toolkit/components/alerts/resources/content/alert.css b/toolkit/components/alerts/resources/content/alert.css
index c4d94a543..81e5cdd35 100644
--- a/toolkit/components/alerts/resources/content/alert.css
+++ b/toolkit/components/alerts/resources/content/alert.css
@@ -3,7 +3,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#alertBox[animate] {
- animation-duration: 20s;
animation-fill-mode: both;
animation-name: alert-animation;
}
diff --git a/toolkit/components/alerts/resources/content/alert.js b/toolkit/components/alerts/resources/content/alert.js
index ead4d503f..ce60ab0fa 100644
--- a/toolkit/components/alerts/resources/content/alert.js
+++ b/toolkit/components/alerts/resources/content/alert.js
@@ -166,7 +166,12 @@ function prefillAlertInfo() {
}
function onAlertLoad() {
- const ALERT_DURATION_IMMEDIATE = 20000;
+ const ALERT_DURATION_IMMEDIATE_MIN = 4000;
+ const ALERT_DURATION_IMMEDIATE_MAX = 60000;
+ let alertDurationImmediate = Services.prefs.getIntPref("alerts.durationImmediate", ALERT_DURATION_IMMEDIATE_MIN);
+ alertDurationImmediate = alertDurationImmediate >= ALERT_DURATION_IMMEDIATE_MIN
+ && alertDurationImmediate <= ALERT_DURATION_IMMEDIATE_MAX
+ ? alertDurationImmediate : ALERT_DURATION_IMMEDIATE_MIN;
let alertTextBox = document.getElementById("alertTextBox");
let alertImageBox = document.getElementById("alertImageBox");
alertImageBox.style.minHeight = alertTextBox.scrollHeight + "px";
@@ -186,7 +191,7 @@ function onAlertLoad() {
// If the require interaction flag is set, prevent auto-closing the notification.
if (!gRequireInteraction) {
if (Services.prefs.getBoolPref("alerts.disableSlidingEffect")) {
- setTimeout(function() { window.close(); }, ALERT_DURATION_IMMEDIATE);
+ setTimeout(function() { window.close(); }, alertDurationImmediate);
} else {
let alertBox = document.getElementById("alertBox");
alertBox.addEventListener("animationend", function hideAlert(event) {
@@ -197,6 +202,7 @@ function onAlertLoad() {
window.close();
}
}, false);
+ alertBox.style.animationDuration = Math.round(alertDurationImmediate / 1000).toString() + "s";
alertBox.setAttribute("animate", true);
}
}
diff --git a/toolkit/components/autocomplete/nsAutoCompleteController.cpp b/toolkit/components/autocomplete/nsAutoCompleteController.cpp
index 5d69ea1a3..9ca382fe5 100644
--- a/toolkit/components/autocomplete/nsAutoCompleteController.cpp
+++ b/toolkit/components/autocomplete/nsAutoCompleteController.cpp
@@ -1637,58 +1637,72 @@ nsAutoCompleteController::ProcessResult(int32_t aSearchIndex, nsIAutoCompleteRes
MOZ_ASSERT(mResults.Count() >= aSearchIndex + 1,
"aSearchIndex should always be valid for mResults");
- uint32_t oldRowCount = mRowCount;
- // If the search failed, increase the match count to include the error
- // description.
- if (searchResult == nsIAutoCompleteResult::RESULT_FAILURE) {
- nsAutoString error;
- aResult->GetErrorDescription(error);
- if (!error.IsEmpty()) {
- ++mRowCount;
- if (mTree) {
- mTree->RowCountChanged(oldRowCount, 1);
+ bool isTypeAheadResult = false;
+ aResult->GetTypeAheadResult(&isTypeAheadResult);
+
+ if (!isTypeAheadResult) {
+ uint32_t oldRowCount = mRowCount;
+ // If the search failed, increase the match count to include the error
+ // description.
+ if (searchResult == nsIAutoCompleteResult::RESULT_FAILURE) {
+ nsAutoString error;
+ aResult->GetErrorDescription(error);
+ if (!error.IsEmpty()) {
+ ++mRowCount;
+ if (mTree) {
+ mTree->RowCountChanged(oldRowCount, 1);
+ }
}
- }
- } else if (searchResult == nsIAutoCompleteResult::RESULT_SUCCESS ||
- searchResult == nsIAutoCompleteResult::RESULT_SUCCESS_ONGOING) {
- // Increase the match count for all matches in this result.
- uint32_t totalMatchCount = 0;
- for (uint32_t i = 0; i < mResults.Length(); i++) {
- nsIAutoCompleteResult* result = mResults.SafeObjectAt(i);
- if (result) {
- uint32_t matchCount = 0;
- result->GetMatchCount(&matchCount);
- totalMatchCount += matchCount;
+ } else if (searchResult == nsIAutoCompleteResult::RESULT_SUCCESS ||
+ searchResult == nsIAutoCompleteResult::RESULT_SUCCESS_ONGOING) {
+ // Increase the match count for all matches in this result.
+ uint32_t totalMatchCount = 0;
+ for (uint32_t i = 0; i < mResults.Length(); i++) {
+ nsIAutoCompleteResult* result = mResults.SafeObjectAt(i);
+ if (result) {
+ // not all results implement this, so it can likely fail.
+ bool typeAhead = false;
+ result->GetTypeAheadResult(&typeAhead);
+ if (!typeAhead) {
+ uint32_t matchCount = 0;
+ result->GetMatchCount(&matchCount);
+ totalMatchCount += matchCount;
+ }
+ }
}
- }
- uint32_t delta = totalMatchCount - oldRowCount;
+ uint32_t delta = totalMatchCount - oldRowCount;
- mRowCount += delta;
- if (mTree) {
- mTree->RowCountChanged(oldRowCount, delta);
+ mRowCount += delta;
+ if (mTree) {
+ mTree->RowCountChanged(oldRowCount, delta);
+ }
}
- }
- // Try to autocomplete the default index for this search.
- // Do this before invalidating so the binding knows about it.
- CompleteDefaultIndex(aSearchIndex);
+ // Try to autocomplete the default index for this search.
+ // Do this before invalidating so the binding knows about it.
+ CompleteDefaultIndex(aSearchIndex);
- // Refresh the popup view to display the new search results
- nsCOMPtr<nsIAutoCompletePopup> popup;
- input->GetPopup(getter_AddRefs(popup));
- NS_ENSURE_TRUE(popup != nullptr, NS_ERROR_FAILURE);
- popup->Invalidate(nsIAutoCompletePopup::INVALIDATE_REASON_NEW_RESULT);
+ // Refresh the popup view to display the new search results
+ nsCOMPtr<nsIAutoCompletePopup> popup;
+ input->GetPopup(getter_AddRefs(popup));
+ NS_ENSURE_TRUE(popup != nullptr, NS_ERROR_FAILURE);
+ popup->Invalidate(nsIAutoCompletePopup::INVALIDATE_REASON_NEW_RESULT);
- uint32_t minResults;
- input->GetMinResultsForPopup(&minResults);
+ uint32_t minResults;
+ input->GetMinResultsForPopup(&minResults);
- // Make sure the popup is open, if necessary, since we now have at least one
- // search result ready to display. Don't force the popup closed if we might
- // get results in the future to avoid unnecessarily canceling searches.
- if (mRowCount || !minResults) {
- OpenPopup();
- } else if (mSearchesOngoing == 0) {
- ClosePopup();
+ // Make sure the popup is open, if necessary, since we now have at least one
+ // search result ready to display. Don't force the popup closed if we might
+ // get results in the future to avoid unnecessarily canceling searches.
+ if (mRowCount || !minResults) {
+ OpenPopup();
+ } else if (mSearchesOngoing == 0) {
+ ClosePopup();
+ }
+ } else if (searchResult == nsIAutoCompleteResult::RESULT_SUCCESS ||
+ searchResult == nsIAutoCompleteResult::RESULT_SUCCESS_ONGOING) {
+ // Try to autocomplete the default index for this search.
+ CompleteDefaultIndex(aSearchIndex);
}
return NS_OK;
@@ -2033,14 +2047,20 @@ nsAutoCompleteController::RowIndexToSearch(int32_t aRowIndex, int32_t *aSearchIn
uint32_t rowCount = 0;
- uint16_t searchResult;
- result->GetSearchResult(&searchResult);
+ // Skip past the result completely if it is marked as hidden
+ bool isTypeAheadResult = false;
+ result->GetTypeAheadResult(&isTypeAheadResult);
- // Find out how many results were provided by the
- // current nsIAutoCompleteSearch.
- if (searchResult == nsIAutoCompleteResult::RESULT_SUCCESS ||
- searchResult == nsIAutoCompleteResult::RESULT_SUCCESS_ONGOING) {
- result->GetMatchCount(&rowCount);
+ if (!isTypeAheadResult) {
+ uint16_t searchResult;
+ result->GetSearchResult(&searchResult);
+
+ // Find out how many results were provided by the
+ // current nsIAutoCompleteSearch.
+ if (searchResult == nsIAutoCompleteResult::RESULT_SUCCESS ||
+ searchResult == nsIAutoCompleteResult::RESULT_SUCCESS_ONGOING) {
+ result->GetMatchCount(&rowCount);
+ }
}
// If the given row index is within the results range
diff --git a/toolkit/components/autocomplete/nsAutoCompleteSimpleResult.cpp b/toolkit/components/autocomplete/nsAutoCompleteSimpleResult.cpp
index 9fd2c0022..683ac462a 100644
--- a/toolkit/components/autocomplete/nsAutoCompleteSimpleResult.cpp
+++ b/toolkit/components/autocomplete/nsAutoCompleteSimpleResult.cpp
@@ -43,7 +43,8 @@ struct AutoCompleteSimpleResultMatch
nsAutoCompleteSimpleResult::nsAutoCompleteSimpleResult() :
mDefaultIndex(-1),
- mSearchResult(RESULT_NOMATCH)
+ mSearchResult(RESULT_NOMATCH),
+ mTypeAheadResult(false)
{
}
@@ -66,6 +67,12 @@ nsAutoCompleteSimpleResult::AppendResult(nsIAutoCompleteResult* aResult)
mErrorDescription = errorDescription;
}
+ bool typeAheadResult = false;
+ if (NS_SUCCEEDED(aResult->GetTypeAheadResult(&typeAheadResult)) &&
+ typeAheadResult) {
+ mTypeAheadResult = typeAheadResult;
+ }
+
int32_t defaultIndex = -1;
if (NS_SUCCEEDED(aResult->GetDefaultIndex(&defaultIndex)) &&
defaultIndex >= 0) {
@@ -166,6 +173,20 @@ nsAutoCompleteSimpleResult::SetErrorDescription(
return NS_OK;
}
+// typeAheadResult
+NS_IMETHODIMP
+nsAutoCompleteSimpleResult::GetTypeAheadResult(bool *aTypeAheadResult)
+{
+ *aTypeAheadResult = mTypeAheadResult;
+ return NS_OK;
+}
+NS_IMETHODIMP
+nsAutoCompleteSimpleResult::SetTypeAheadResult(bool aTypeAheadResult)
+{
+ mTypeAheadResult = aTypeAheadResult;
+ return NS_OK;
+}
+
NS_IMETHODIMP
nsAutoCompleteSimpleResult::InsertMatchAt(int32_t aIndex,
const nsAString& aValue,
diff --git a/toolkit/components/autocomplete/nsAutoCompleteSimpleResult.h b/toolkit/components/autocomplete/nsAutoCompleteSimpleResult.h
index 28968aa57..61ee542e4 100644
--- a/toolkit/components/autocomplete/nsAutoCompleteSimpleResult.h
+++ b/toolkit/components/autocomplete/nsAutoCompleteSimpleResult.h
@@ -38,6 +38,8 @@ protected:
int32_t mDefaultIndex;
uint32_t mSearchResult;
+ bool mTypeAheadResult;
+
nsCOMPtr<nsIAutoCompleteSimpleResultListener> mListener;
};
diff --git a/toolkit/components/autocomplete/nsIAutoCompleteResult.idl b/toolkit/components/autocomplete/nsIAutoCompleteResult.idl
index c719d9427..9ae22ade7 100644
--- a/toolkit/components/autocomplete/nsIAutoCompleteResult.idl
+++ b/toolkit/components/autocomplete/nsIAutoCompleteResult.idl
@@ -50,6 +50,13 @@ interface nsIAutoCompleteResult : nsISupports
readonly attribute unsigned long matchCount;
/**
+ * If true, the results will not be displayed in the popup. However,
+ * if a default index is specified, the default item will still be
+ * completed in the input.
+ */
+ readonly attribute boolean typeAheadResult;
+
+ /**
* Get the value of the result at the given index
*/
AString getValueAt(in long index);
diff --git a/toolkit/components/autocomplete/nsIAutoCompleteSimpleResult.idl b/toolkit/components/autocomplete/nsIAutoCompleteSimpleResult.idl
index 5e92e037a..6a8827ab8 100644
--- a/toolkit/components/autocomplete/nsIAutoCompleteSimpleResult.idl
+++ b/toolkit/components/autocomplete/nsIAutoCompleteSimpleResult.idl
@@ -42,6 +42,12 @@ interface nsIAutoCompleteSimpleResult : nsIAutoCompleteResult
void setSearchResult(in unsigned short aSearchResult);
/**
+ * A writer for the readonly attribute 'typeAheadResult', typically set
+ * because a result is only intended for type-ahead completion.
+ */
+ void setTypeAheadResult(in boolean aHidden);
+
+ /**
* Inserts a match consisting of the given value, comment, image, style and
* the value to use for defaultIndex completion at a given position.
* @param aIndex
diff --git a/toolkit/components/autocomplete/tests/unit/head_autocomplete.js b/toolkit/components/autocomplete/tests/unit/head_autocomplete.js
index 1443879f0..5a458bdf4 100644
--- a/toolkit/components/autocomplete/tests/unit/head_autocomplete.js
+++ b/toolkit/components/autocomplete/tests/unit/head_autocomplete.js
@@ -85,6 +85,11 @@ AutoCompleteResultBase.prototype = {
defaultIndex: -1,
+ _typeAheadResult: false,
+ get typeAheadResult() {
+ return this._typeAheadResult;
+ },
+
get matchCount() {
return this._values.length;
},
diff --git a/toolkit/components/autocomplete/tests/unit/test_hiddenResult.js b/toolkit/components/autocomplete/tests/unit/test_hiddenResult.js
new file mode 100644
index 000000000..8e2485716
--- /dev/null
+++ b/toolkit/components/autocomplete/tests/unit/test_hiddenResult.js
@@ -0,0 +1,76 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+function AutoCompleteResult(aValues) {
+ this._values = aValues;
+ this.defaultIndex = -1;
+ this._typeAheadResult = false;
+}
+AutoCompleteResult.prototype = Object.create(AutoCompleteResultBase.prototype);
+
+function AutoCompleteTypeAheadResult(aValues) {
+ this._values = aValues;
+ this.defaultIndex = 0;
+ this._typeAheadResult = true;
+}
+AutoCompleteTypeAheadResult.prototype = Object.create(AutoCompleteResultBase.prototype);
+
+
+/**
+ * Test AutoComplete with multiple AutoCompleteSearch sources, with one of them
+ * being hidden from the popup, but can still do typeahead completion.
+ */
+function run_test() {
+ do_test_pending();
+
+ var inputStr = "moz";
+
+ // Type ahead result
+ var searchTypeAhead = new AutoCompleteSearchBase("search1",
+ new AutoCompleteTypeAheadResult(["mozillaTest1"]));
+ // Regular result
+ var searchNormal = new AutoCompleteSearchBase("search2",
+ new AutoCompleteResult(["mozillaTest2"]));
+
+ // Register searches so AutoCompleteController can find them
+ registerAutoCompleteSearch(searchNormal);
+ registerAutoCompleteSearch(searchTypeAhead);
+
+ // Make an AutoCompleteInput that uses our searches
+ // and confirms results on search complete.
+ var input = new AutoCompleteInputBase([searchTypeAhead.name, searchNormal.name]);
+ input.completeDefaultIndex = true;
+ input.textValue = inputStr;
+
+ // Caret must be at the end. Autofill doesn't happen unless you're typing
+ // characters at the end.
+ var strLen = inputStr.length;
+ input.selectTextRange(strLen, strLen);
+ do_check_eq(input.selectionStart, strLen);
+ do_check_eq(input.selectionEnd, strLen);
+
+ var controller = Cc["@mozilla.org/autocomplete/controller;1"].
+ getService(Ci.nsIAutoCompleteController);
+
+ controller.input = input;
+ controller.startSearch(inputStr);
+
+ input.onSearchComplete = function() {
+ // Hidden results should still be able to do inline autocomplete
+ do_check_eq(input.textValue, "mozillaTest1");
+
+ // Now, let's fill the textbox with the first result of the popup.
+ // The first search is marked as hidden, so we must always get the
+ // second search.
+ controller.handleEnter(true);
+ do_check_eq(input.textValue, "mozillaTest2");
+
+ // Only one item in the popup.
+ do_check_eq(controller.matchCount, 1);
+
+ // Unregister searches
+ unregisterAutoCompleteSearch(searchNormal);
+ unregisterAutoCompleteSearch(searchTypeAhead);
+ do_test_finished();
+ };
+}
diff --git a/toolkit/components/autocomplete/tests/unit/test_popupSelectionVsDefaultCompleteValue.js b/toolkit/components/autocomplete/tests/unit/test_popupSelectionVsDefaultCompleteValue.js
new file mode 100644
index 000000000..fb4153355
--- /dev/null
+++ b/toolkit/components/autocomplete/tests/unit/test_popupSelectionVsDefaultCompleteValue.js
@@ -0,0 +1,71 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+function AutoCompleteTypeAheadResult(aValues, aFinalCompleteValues) {
+ this._values = aValues;
+ this._finalCompleteValues = aFinalCompleteValues;
+ this.defaultIndex = 0;
+ this._typeAheadResult = true;
+}
+AutoCompleteTypeAheadResult.prototype = Object.create(AutoCompleteResultBase.prototype);
+
+function AutoCompleteResult(aValues) {
+ this._values = aValues;
+}
+AutoCompleteResult.prototype = Object.create(AutoCompleteResultBase.prototype);
+
+function AutoCompleteInput(aSearches) {
+ this.searches = aSearches;
+ this.popupOpen = true;
+ this.completeDefaultIndex = true;
+ this.completeSelectedIndex = true;
+}
+AutoCompleteInput.prototype = Object.create(AutoCompleteInputBase.prototype);
+
+function run_test() {
+ run_next_test();
+}
+
+add_test(function test_handleEnter() {
+ doSearch("moz", function(aController) {
+ do_check_eq(aController.input.textValue, "mozilla.com");
+ aController.handleEnter(true);
+ do_check_eq(aController.input.textValue, "mozilla.org");
+ });
+});
+
+function doSearch(aSearchString, aOnCompleteCallback) {
+ let typeAheadSearch = new AutoCompleteSearchBase(
+ "typeAheadSearch",
+ new AutoCompleteTypeAheadResult([ "mozilla.com" ], [ "http://www.mozilla.com" ])
+ );
+ registerAutoCompleteSearch(typeAheadSearch);
+
+ let search = new AutoCompleteSearchBase(
+ "search",
+ new AutoCompleteResult([ "mozilla.org" ])
+ );
+ registerAutoCompleteSearch(search);
+
+ let controller = Cc["@mozilla.org/autocomplete/controller;1"].
+ getService(Ci.nsIAutoCompleteController);
+
+ // Make an AutoCompleteInput that uses our searches and confirms results.
+ let input = new AutoCompleteInput([ typeAheadSearch.name, search.name ]);
+ input.textValue = aSearchString;
+
+ // Caret must be at the end for autofill to happen.
+ let strLen = aSearchString.length;
+ input.selectTextRange(strLen, strLen);
+ controller.input = input;
+ controller.startSearch(aSearchString);
+
+ input.onSearchComplete = function onSearchComplete() {
+ aOnCompleteCallback(controller);
+
+ // Clean up.
+ unregisterAutoCompleteSearch(search);
+ run_next_test();
+ };
+}
diff --git a/toolkit/components/autocomplete/tests/unit/xpcshell.ini b/toolkit/components/autocomplete/tests/unit/xpcshell.ini
index 4d193965c..daf89db17 100644
--- a/toolkit/components/autocomplete/tests/unit/xpcshell.ini
+++ b/toolkit/components/autocomplete/tests/unit/xpcshell.ini
@@ -18,7 +18,9 @@ tail =
[test_finalCompleteValue_forceComplete.js]
[test_finalCompleteValueSelectedIndex.js]
[test_finalDefaultCompleteValue.js]
+[test_hiddenResult.js]
[test_immediate_search.js]
[test_insertMatchAt.js]
+[test_popupSelectionVsDefaultCompleteValue.js]
[test_previousResult.js]
[test_stopSearch.js]
diff --git a/toolkit/components/filepicker/nsFileView.cpp b/toolkit/components/filepicker/nsFileView.cpp
index ad4471e86..9a8278496 100644
--- a/toolkit/components/filepicker/nsFileView.cpp
+++ b/toolkit/components/filepicker/nsFileView.cpp
@@ -133,6 +133,13 @@ NS_IMETHODIMP nsFileResult::GetMatchCount(uint32_t *aMatchCount)
return NS_OK;
}
+NS_IMETHODIMP nsFileResult::GetTypeAheadResult(bool *aTypeAheadResult)
+{
+ NS_ENSURE_ARG_POINTER(aTypeAheadResult);
+ *aTypeAheadResult = false;
+ return NS_OK;
+}
+
NS_IMETHODIMP nsFileResult::GetValueAt(int32_t index, nsAString & aValue)
{
aValue = mValues[index];
diff --git a/toolkit/components/jsdownloads/src/DownloadIntegration.jsm b/toolkit/components/jsdownloads/src/DownloadIntegration.jsm
index 1c30599f5..7439d9d11 100644
--- a/toolkit/components/jsdownloads/src/DownloadIntegration.jsm
+++ b/toolkit/components/jsdownloads/src/DownloadIntegration.jsm
@@ -530,20 +530,34 @@ this.DownloadIntegration = {
* @return true if files should be marked
*/
_shouldSaveZoneInformation() {
- let key = Cc["@mozilla.org/windows-registry-key;1"]
- .createInstance(Ci.nsIWindowsRegKey);
+ let zonePref = 2;
try {
- key.open(Ci.nsIWindowsRegKey.ROOT_KEY_CURRENT_USER,
- "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Attachments",
- Ci.nsIWindowsRegKey.ACCESS_QUERY_VALUE);
- try {
- return key.readIntValue("SaveZoneInformation") != 1;
- } finally {
- key.close();
- }
- } catch (ex) {
- // If the key is not present, files should be marked by default.
- return true;
+ zonePref = Services.prefs.getIntPref("browser.download.saveZoneInformation");
+ } catch (ex) {}
+
+ switch (zonePref) {
+ case 0: // Never
+ return false;
+ case 1: // Always
+ return true;
+ case 2: // System-defined
+ let key = Cc["@mozilla.org/windows-registry-key;1"]
+ .createInstance(Ci.nsIWindowsRegKey);
+ try {
+ key.open(Ci.nsIWindowsRegKey.ROOT_KEY_CURRENT_USER,
+ "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Attachments",
+ Ci.nsIWindowsRegKey.ACCESS_QUERY_VALUE);
+ try {
+ return key.readIntValue("SaveZoneInformation") != 1;
+ } finally {
+ key.close();
+ }
+ } catch (ex) {
+ // If the key is not present, files should be marked by default.
+ return true;
+ }
+ default: // Invalid pref value defaults marking files.
+ return true;
}
},
#endif
diff --git a/toolkit/components/moz.build b/toolkit/components/moz.build
index 12e1748e9..5dba09a32 100644
--- a/toolkit/components/moz.build
+++ b/toolkit/components/moz.build
@@ -79,9 +79,6 @@ if not CONFIG['MOZ_FENNEC']:
if CONFIG['NS_PRINTING']:
DIRS += ['printing']
-if CONFIG['MOZ_CRASHREPORTER']:
- DIRS += ['crashes']
-
if CONFIG['BUILD_CTYPES']:
DIRS += ['ctypes']
diff --git a/toolkit/components/mozintl/MozIntl.cpp b/toolkit/components/mozintl/MozIntl.cpp
index 9c393c296..9c61c73a6 100644
--- a/toolkit/components/mozintl/MozIntl.cpp
+++ b/toolkit/components/mozintl/MozIntl.cpp
@@ -48,6 +48,32 @@ MozIntl::AddGetCalendarInfo(JS::Handle<JS::Value> val, JSContext* cx)
return NS_OK;
}
+NS_IMETHODIMP
+MozIntl::AddGetDisplayNames(JS::Handle<JS::Value> val, JSContext* cx)
+{
+ if (!val.isObject()) {
+ return NS_ERROR_INVALID_ARG;
+ }
+
+ JS::Rooted<JSObject*> realIntlObj(cx, js::CheckedUnwrap(&val.toObject()));
+ if (!realIntlObj) {
+ return NS_ERROR_INVALID_ARG;
+ }
+
+ JSAutoCompartment ac(cx, realIntlObj);
+
+ static const JSFunctionSpec funcs[] = {
+ JS_SELF_HOSTED_FN("getDisplayNames", "Intl_getDisplayNames", 2, 0),
+ JS_FS_END
+ };
+
+ if (!JS_DefineFunctions(cx, realIntlObj, funcs)) {
+ return NS_ERROR_FAILURE;
+ }
+
+ return NS_OK;
+}
+
NS_GENERIC_FACTORY_CONSTRUCTOR(MozIntl)
NS_DEFINE_NAMED_CID(MOZ_MOZINTL_CID);
diff --git a/toolkit/components/mozintl/mozIMozIntl.idl b/toolkit/components/mozintl/mozIMozIntl.idl
index 67be184d4..f28824d47 100644
--- a/toolkit/components/mozintl/mozIMozIntl.idl
+++ b/toolkit/components/mozintl/mozIMozIntl.idl
@@ -9,4 +9,5 @@
interface mozIMozIntl : nsISupports
{
[implicit_jscontext] void addGetCalendarInfo(in jsval intlObject);
+ [implicit_jscontext] void addGetDisplayNames(in jsval intlObject);
};
diff --git a/toolkit/components/mozintl/test/test_mozintl.js b/toolkit/components/mozintl/test/test_mozintl.js
index 0eca2c67e..8d2720bf0 100644
--- a/toolkit/components/mozintl/test/test_mozintl.js
+++ b/toolkit/components/mozintl/test/test_mozintl.js
@@ -7,6 +7,7 @@ function run_test() {
test_this_global(mozIntl);
test_cross_global(mozIntl);
+ test_methods_presence(mozIntl);
ok(true);
}
@@ -30,3 +31,16 @@ function test_cross_global(mozIntl) {
equal(waivedX.getCalendarInfo() instanceof Object, false);
equal(waivedX.getCalendarInfo() instanceof global.Object, true);
}
+
+function test_methods_presence(mozIntl) {
+ equal(mozIntl.addGetCalendarInfo instanceof Function, true);
+ equal(mozIntl.addGetDisplayNames instanceof Function, true);
+
+ let x = {};
+
+ mozIntl.addGetCalendarInfo(x);
+ equal(x.getCalendarInfo instanceof Function, true);
+
+ mozIntl.addGetDisplayNames(x);
+ equal(x.getDisplayNames instanceof Function, true);
+}
diff --git a/toolkit/components/passwordmgr/content/passwordManager.js b/toolkit/components/passwordmgr/content/passwordManager.js
index 333dc1d24..da63d7de8 100644
--- a/toolkit/components/passwordmgr/content/passwordManager.js
+++ b/toolkit/components/passwordmgr/content/passwordManager.js
@@ -80,6 +80,8 @@ function Startup() {
togglePasswordsButton.label = kSignonBundle.getString("showPasswords");
togglePasswordsButton.accessKey = kSignonBundle.getString("showPasswordsAccessKey");
signonsIntro.textContent = kSignonBundle.getString("loginsDescriptionAll");
+ removeAllButton.setAttribute("label", kSignonBundle.getString("removeAll.label"));
+ removeAllButton.setAttribute("accesskey", kSignonBundle.getString("removeAll.accesskey"));
document.getElementsByTagName("treecols")[0].addEventListener("click", (event) => {
let { target, button } = event;
let sortField = target.getAttribute("data-field-name");
@@ -555,6 +557,8 @@ function SignonClearFilter() {
signonsTreeView._lastSelectedRanges = [];
signonsIntro.textContent = kSignonBundle.getString("loginsDescriptionAll");
+ removeAllButton.setAttribute("label", kSignonBundle.getString("removeAll.label"));
+ removeAllButton.setAttribute("accesskey", kSignonBundle.getString("removeAll.accesskey"));
}
function FocusFilterBox() {
@@ -623,6 +627,8 @@ function FilterPasswords() {
signonsTreeView.selection.select(0);
signonsIntro.textContent = kSignonBundle.getString("loginsDescriptionFiltered");
+ removeAllButton.setAttribute("label", kSignonBundle.getString("removeAllShown.label"));
+ removeAllButton.setAttribute("accesskey", kSignonBundle.getString("removeAllShown.accesskey"));
}
function CopyPassword() {
@@ -721,8 +727,10 @@ function escapeKeyHandler() {
window.close();
}
+#if defined(MC_BASILISK) && defined(XP_WIN)
function OpenMigrator() {
const { MigrationUtils } = Cu.import("resource:///modules/MigrationUtils.jsm", {});
// We pass in the type of source we're using for use in telemetry:
MigrationUtils.showMigrationWizard(window, [MigrationUtils.MIGRATION_ENTRYPOINT_PASSWORDS]);
}
+#endif
diff --git a/toolkit/components/passwordmgr/content/passwordManager.xul b/toolkit/components/passwordmgr/content/passwordManager.xul
index d248283b6..c0a10bf8e 100644
--- a/toolkit/components/passwordmgr/content/passwordManager.xul
+++ b/toolkit/components/passwordmgr/content/passwordManager.xul
@@ -110,10 +110,9 @@
label="&remove.label;" accesskey="&remove.accesskey;"
oncommand="DeleteSignon();"/>
<button id="removeAllSignons" icon="clear"
- label="&removeall.label;" accesskey="&removeall.accesskey;"
oncommand="DeleteAllSignons();"/>
<spacer flex="1"/>
-#if defined(MOZ_BUILD_APP_IS_BROWSER) && defined(XP_WIN)
+#if defined(MC_BASILISK) && defined(XP_WIN)
<button accesskey="&import.accesskey;"
label="&import.label;"
oncommand="OpenMigrator();"/>
diff --git a/toolkit/components/passwordmgr/jar.mn b/toolkit/components/passwordmgr/jar.mn
index 9fa574e49..db6d7ffef 100644
--- a/toolkit/components/passwordmgr/jar.mn
+++ b/toolkit/components/passwordmgr/jar.mn
@@ -5,5 +5,5 @@
toolkit.jar:
% content passwordmgr %content/passwordmgr/
* content/passwordmgr/passwordManager.xul (content/passwordManager.xul)
- content/passwordmgr/passwordManager.js (content/passwordManager.js)
+* content/passwordmgr/passwordManager.js (content/passwordManager.js)
content/passwordmgr/recipes.json (content/recipes.json)
diff --git a/toolkit/components/passwordmgr/nsLoginManagerPrompter.js b/toolkit/components/passwordmgr/nsLoginManagerPrompter.js
index b66489234..720e80446 100644
--- a/toolkit/components/passwordmgr/nsLoginManagerPrompter.js
+++ b/toolkit/components/passwordmgr/nsLoginManagerPrompter.js
@@ -808,6 +808,9 @@ LoginManagerPrompter.prototype = {
*/
_showLoginCaptureDoorhanger(login, type) {
let { browser } = this._getNotifyWindow();
+ if (!browser) {
+ return;
+ }
let saveMsgNames = {
prompt: login.username === "" ? "rememberLoginMsgNoUser"
@@ -1405,10 +1408,34 @@ LoginManagerPrompter.prototype = {
* Given a content DOM window, returns the chrome window and browser it's in.
*/
_getChromeWindow: function (aWindow) {
+ // Handle non-e10s toolkit consumers.
+ if (!Cu.isCrossProcessWrapper(aWindow)) {
+ let chromeWin = aWindow.QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIWebNavigation)
+ .QueryInterface(Ci.nsIDocShell)
+ .chromeEventHandler.ownerGlobal;
+ if (!chromeWin) {
+ return null;
+ }
+
+ // gBrowser only exists on some apps, like Firefox.
+ let tabbrowser = chromeWin.gBrowser ||
+ (typeof chromeWin.getBrowser == "function" ? chromeWin.getBrowser() : null);
+ // At least serve the chrome window if getBrowser()
+ // or getBrowserForContentWindow() are not supported.
+ if (!tabbrowser || typeof tabbrowser.getBrowserForContentWindow != "function") {
+ return { win: chromeWin };
+ }
+
+ let browser = tabbrowser.getBrowserForContentWindow(aWindow);
+ return { win: chromeWin, browser };
+ }
+
let windows = Services.wm.getEnumerator(null);
while (windows.hasMoreElements()) {
let win = windows.getNext();
- let browser = win.gBrowser.getBrowserForContentWindow(aWindow);
+ let tabbrowser = win.gBrowser || win.getBrowser();
+ let browser = tabbrowser.getBrowserForContentWindow(aWindow);
if (browser) {
return { win, browser };
}
diff --git a/toolkit/components/passwordmgr/test/unit/test_logins_search.js b/toolkit/components/passwordmgr/test/unit/test_logins_search.js
index 188c75039..730771981 100644
--- a/toolkit/components/passwordmgr/test/unit/test_logins_search.js
+++ b/toolkit/components/passwordmgr/test/unit/test_logins_search.js
@@ -192,7 +192,6 @@ add_task(function test_search_all_full_case_sensitive()
{
checkAllSearches({ hostname: "http://www.example.com" }, 1);
checkAllSearches({ hostname: "http://www.example.com/" }, 0);
- checkAllSearches({ hostname: "http://" }, 0);
checkAllSearches({ hostname: "example.com" }, 0);
checkAllSearches({ formSubmitURL: "http://www.example.com" }, 2);
diff --git a/toolkit/components/places/UnifiedComplete.js b/toolkit/components/places/UnifiedComplete.js
index ad3d35aab..acd358b11 100644
--- a/toolkit/components/places/UnifiedComplete.js
+++ b/toolkit/components/places/UnifiedComplete.js
@@ -1245,7 +1245,7 @@ Search.prototype = {
// * If the protocol differs we should not match. For example if the user
// searched https we should not return http.
try {
- let prefixURI = NetUtil.newURI(this._strippedPrefix);
+ let prefixURI = NetUtil.newURI(this._strippedPrefix + match.token);
let finalURI = NetUtil.newURI(match.url);
if (prefixURI.scheme != finalURI.scheme)
return false;
diff --git a/toolkit/components/places/moz.build b/toolkit/components/places/moz.build
index adac79cba..85e1e93e1 100644
--- a/toolkit/components/places/moz.build
+++ b/toolkit/components/places/moz.build
@@ -78,6 +78,8 @@ if CONFIG['MOZ_PLACES']:
EXTRA_COMPONENTS += [
'ColorAnalyzer.js',
'nsLivemarkService.js',
+ 'nsPlacesAutoComplete.js',
+ 'nsPlacesAutoComplete.manifest',
'nsPlacesExpiration.js',
'nsTaggingService.js',
'PageIconProtocolHandler.js',
diff --git a/toolkit/components/places/nsNavBookmarks.cpp b/toolkit/components/places/nsNavBookmarks.cpp
index 74707be99..693aaf5db 100644
--- a/toolkit/components/places/nsNavBookmarks.cpp
+++ b/toolkit/components/places/nsNavBookmarks.cpp
@@ -2518,8 +2518,6 @@ nsNavBookmarks::GetURIForKeyword(const nsAString& aUserCasedKeyword,
NS_ENSURE_TRUE(!aUserCasedKeyword.IsEmpty(), NS_ERROR_INVALID_ARG);
*aURI = nullptr;
- PLACES_WARN_DEPRECATED();
-
// Shortcuts are always lowercased internally.
nsAutoString keyword(aUserCasedKeyword);
ToLowerCase(keyword);
diff --git a/toolkit/components/places/nsNavHistory.cpp b/toolkit/components/places/nsNavHistory.cpp
index 8cf3a2e32..49d911d65 100644
--- a/toolkit/components/places/nsNavHistory.cpp
+++ b/toolkit/components/places/nsNavHistory.cpp
@@ -949,6 +949,10 @@ nsresult // static
nsNavHistory::AsciiHostNameFromHostString(const nsACString& aHostName,
nsACString& aAscii)
{
+ aAscii.Truncate();
+ if (aHostName.IsEmpty()) {
+ return NS_OK;
+ }
// To properly generate a uri we must provide a protocol.
nsAutoCString fakeURL("http://");
fakeURL.Append(aHostName);
@@ -2792,8 +2796,6 @@ nsNavHistory::MarkPageAsFollowedLink(nsIURI *aURI)
NS_IMETHODIMP
nsNavHistory::GetPageTitle(nsIURI* aURI, nsAString& aTitle)
{
- PLACES_WARN_DEPRECATED();
-
NS_ASSERTION(NS_IsMainThread(), "This can only be called on the main thread");
NS_ENSURE_ARG(aURI);
diff --git a/toolkit/components/places/nsPlacesAutoComplete.js b/toolkit/components/places/nsPlacesAutoComplete.js
new file mode 100644
index 000000000..29bdae4c1
--- /dev/null
+++ b/toolkit/components/places/nsPlacesAutoComplete.js
@@ -0,0 +1,1778 @@
+/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*-
+ * vim: sw=2 ts=2 sts=2 expandtab
+ * 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/. */
+
+Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
+Components.utils.import("resource://gre/modules/Services.jsm");
+XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils",
+ "resource://gre/modules/PlacesUtils.jsm");
+XPCOMUtils.defineLazyModuleGetter(this, "TelemetryStopwatch",
+ "resource://gre/modules/TelemetryStopwatch.jsm");
+XPCOMUtils.defineLazyModuleGetter(this, "NetUtil",
+ "resource://gre/modules/NetUtil.jsm");
+XPCOMUtils.defineLazyModuleGetter(this, "Task",
+ "resource://gre/modules/Task.jsm");
+
+////////////////////////////////////////////////////////////////////////////////
+//// Constants
+
+const Cc = Components.classes;
+const Ci = Components.interfaces;
+const Cr = Components.results;
+
+// This SQL query fragment provides the following:
+// - whether the entry is bookmarked (kQueryIndexBookmarked)
+// - the bookmark title, if it is a bookmark (kQueryIndexBookmarkTitle)
+// - the tags associated with a bookmarked entry (kQueryIndexTags)
+const kBookTagSQLFragment =
+ `EXISTS(SELECT 1 FROM moz_bookmarks WHERE fk = h.id) AS bookmarked,
+ (
+ SELECT title FROM moz_bookmarks WHERE fk = h.id AND title NOTNULL
+ ORDER BY lastModified DESC LIMIT 1
+ ) AS btitle,
+ (
+ SELECT GROUP_CONCAT(t.title, ',')
+ FROM moz_bookmarks b
+ JOIN moz_bookmarks t ON t.id = +b.parent AND t.parent = :parent
+ WHERE b.fk = h.id
+ ) AS tags`;
+
+// observer topics
+const kTopicShutdown = "places-shutdown";
+const kPrefChanged = "nsPref:changed";
+
+// Match type constants. These indicate what type of search function we should
+// be using.
+const MATCH_ANYWHERE = Ci.mozIPlacesAutoComplete.MATCH_ANYWHERE;
+const MATCH_BOUNDARY_ANYWHERE = Ci.mozIPlacesAutoComplete.MATCH_BOUNDARY_ANYWHERE;
+const MATCH_BOUNDARY = Ci.mozIPlacesAutoComplete.MATCH_BOUNDARY;
+const MATCH_BEGINNING = Ci.mozIPlacesAutoComplete.MATCH_BEGINNING;
+const MATCH_BEGINNING_CASE_SENSITIVE = Ci.mozIPlacesAutoComplete.MATCH_BEGINNING_CASE_SENSITIVE;
+
+// AutoComplete index constants. All AutoComplete queries will provide these
+// columns in this order.
+const kQueryIndexURL = 0;
+const kQueryIndexTitle = 1;
+const kQueryIndexFaviconURL = 2;
+const kQueryIndexBookmarked = 3;
+const kQueryIndexBookmarkTitle = 4;
+const kQueryIndexTags = 5;
+const kQueryIndexVisitCount = 6;
+const kQueryIndexTyped = 7;
+const kQueryIndexPlaceId = 8;
+const kQueryIndexQueryType = 9;
+const kQueryIndexOpenPageCount = 10;
+
+// AutoComplete query type constants. Describes the various types of queries
+// that we can process.
+const kQueryTypeKeyword = 0;
+const kQueryTypeFiltered = 1;
+
+// This separator is used as an RTL-friendly way to split the title and tags.
+// It can also be used by an nsIAutoCompleteResult consumer to re-split the
+// "comment" back into the title and the tag.
+const kTitleTagsSeparator = " \u2013 ";
+
+const kBrowserUrlbarBranch = "browser.urlbar.";
+// Toggle autocomplete.
+const kBrowserUrlbarAutocompleteEnabledPref = "autocomplete.enabled";
+// Toggle autoFill.
+const kBrowserUrlbarAutofillPref = "autoFill";
+// Whether to search only typed entries.
+const kBrowserUrlbarAutofillTypedPref = "autoFill.typed";
+
+// The Telemetry histogram for urlInlineComplete query on domain
+const DOMAIN_QUERY_TELEMETRY = "PLACES_AUTOCOMPLETE_URLINLINE_DOMAIN_QUERY_TIME_MS";
+
+////////////////////////////////////////////////////////////////////////////////
+//// Globals
+
+XPCOMUtils.defineLazyServiceGetter(this, "gTextURIService",
+ "@mozilla.org/intl/texttosuburi;1",
+ "nsITextToSubURI");
+
+////////////////////////////////////////////////////////////////////////////////
+//// Helpers
+
+/**
+ * Initializes our temporary table on a given database.
+ *
+ * @param aDatabase
+ * The mozIStorageConnection to set up the temp table on.
+ */
+function initTempTable(aDatabase)
+{
+ // Note: this should be kept up-to-date with the definition in
+ // nsPlacesTables.h.
+ let stmt = aDatabase.createAsyncStatement(
+ `CREATE TEMP TABLE moz_openpages_temp (
+ url TEXT PRIMARY KEY
+ , open_count INTEGER
+ )`
+ );
+ stmt.executeAsync();
+ stmt.finalize();
+
+ // Note: this should be kept up-to-date with the definition in
+ // nsPlacesTriggers.h.
+ stmt = aDatabase.createAsyncStatement(
+ `CREATE TEMPORARY TRIGGER moz_openpages_temp_afterupdate_trigger
+ AFTER UPDATE OF open_count ON moz_openpages_temp FOR EACH ROW
+ WHEN NEW.open_count = 0
+ BEGIN
+ DELETE FROM moz_openpages_temp
+ WHERE url = NEW.url;
+ END`
+ );
+ stmt.executeAsync();
+ stmt.finalize();
+}
+
+/**
+ * Used to unescape encoded URI strings, and drop information that we do not
+ * care about for searching.
+ *
+ * @param aURIString
+ * The text to unescape and modify.
+ * @return the modified uri.
+ */
+function fixupSearchText(aURIString)
+{
+ let uri = stripPrefix(aURIString);
+ return gTextURIService.unEscapeURIForUI("UTF-8", uri);
+}
+
+/**
+ * Strip prefixes from the URI that we don't care about for searching.
+ *
+ * @param aURIString
+ * The text to modify.
+ * @return the modified uri.
+ */
+function stripPrefix(aURIString)
+{
+ let uri = aURIString;
+
+ if (uri.indexOf("http://") == 0) {
+ uri = uri.slice(7);
+ }
+ else if (uri.indexOf("https://") == 0) {
+ uri = uri.slice(8);
+ }
+ else if (uri.indexOf("ftp://") == 0) {
+ uri = uri.slice(6);
+ }
+
+ if (uri.indexOf("www.") == 0) {
+ uri = uri.slice(4);
+ }
+ return uri;
+}
+
+/**
+ * safePrefGetter get the pref with type safety.
+ * This will return the default value provided if no pref is set.
+ *
+ * @param aPrefBranch
+ * The nsIPrefBranch containing the required preference
+ * @param aName
+ * A preference name
+ * @param aDefault
+ * The preference's default value
+ * @return the preference value or provided default
+ */
+
+function safePrefGetter(aPrefBranch, aName, aDefault) {
+ let types = {
+ boolean: "Bool",
+ number: "Int",
+ string: "Char"
+ };
+ let type = types[typeof(aDefault)];
+ if (!type) {
+ throw "Unknown type!";
+ }
+
+ // If the pref isn't set, we want to use the default.
+ if (aPrefBranch.getPrefType(aName) == Ci.nsIPrefBranch.PREF_INVALID) {
+ return aDefault;
+ }
+ try {
+ return aPrefBranch["get" + type + "Pref"](aName);
+ }
+ catch (e) {
+ return aDefault;
+ }
+}
+
+/**
+ * Whether UnifiedComplete is alive.
+ */
+function isUnifiedCompleteInstantiated() {
+ try {
+ return Components.manager.QueryInterface(Ci.nsIServiceManager)
+ .isServiceInstantiated(Cc["@mozilla.org/autocomplete/search;1?name=unifiedcomplete"],
+ Ci.mozIPlacesAutoComplete);
+ } catch (ex) {
+ return false;
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+//// AutoCompleteStatementCallbackWrapper class
+
+/**
+ * Wraps a callback and ensures that handleCompletion is not dispatched if the
+ * query is no longer tracked.
+ *
+ * @param aAutocomplete
+ * A reference to a nsPlacesAutoComplete.
+ * @param aCallback
+ * A reference to a mozIStorageStatementCallback
+ * @param aDBConnection
+ * The database connection to execute the queries on.
+ */
+function AutoCompleteStatementCallbackWrapper(aAutocomplete, aCallback,
+ aDBConnection)
+{
+ this._autocomplete = aAutocomplete;
+ this._callback = aCallback;
+ this._db = aDBConnection;
+}
+
+AutoCompleteStatementCallbackWrapper.prototype = {
+ //////////////////////////////////////////////////////////////////////////////
+ //// mozIStorageStatementCallback
+
+ handleResult: function ACSCW_handleResult(aResultSet)
+ {
+ this._callback.handleResult.apply(this._callback, arguments);
+ },
+
+ handleError: function ACSCW_handleError(aError)
+ {
+ this._callback.handleError.apply(this._callback, arguments);
+ },
+
+ handleCompletion: function ACSCW_handleCompletion(aReason)
+ {
+ // Only dispatch handleCompletion if we are not done searching and are a
+ // pending search.
+ if (!this._autocomplete.isSearchComplete() &&
+ this._autocomplete.isPendingSearch(this._handle)) {
+ this._callback.handleCompletion.apply(this._callback, arguments);
+ }
+ },
+
+ //////////////////////////////////////////////////////////////////////////////
+ //// AutoCompleteStatementCallbackWrapper
+
+ /**
+ * Executes the specified query asynchronously. This object will notify
+ * this._callback if we should notify (logic explained in handleCompletion).
+ *
+ * @param aQueries
+ * The queries to execute asynchronously.
+ * @return a mozIStoragePendingStatement that can be used to cancel the
+ * queries.
+ */
+ executeAsync: function ACSCW_executeAsync(aQueries)
+ {
+ return this._handle = this._db.executeAsync(aQueries, aQueries.length,
+ this);
+ },
+
+ //////////////////////////////////////////////////////////////////////////////
+ //// nsISupports
+
+ QueryInterface: XPCOMUtils.generateQI([
+ Ci.mozIStorageStatementCallback,
+ ])
+};
+
+////////////////////////////////////////////////////////////////////////////////
+//// nsPlacesAutoComplete class
+//// @mozilla.org/autocomplete/search;1?name=history
+
+function nsPlacesAutoComplete()
+{
+ //////////////////////////////////////////////////////////////////////////////
+ //// Shared Constants for Smart Getters
+
+ // TODO bug 412736 in case of a frecency tie, break it with h.typed and
+ // h.visit_count which is better than nothing. This is slow, so not doing it
+ // yet...
+ function baseQuery(conditions = "") {
+ let query = `SELECT h.url, h.title, f.url, ${kBookTagSQLFragment},
+ h.visit_count, h.typed, h.id, :query_type,
+ t.open_count
+ FROM moz_places h
+ LEFT JOIN moz_favicons f ON f.id = h.favicon_id
+ LEFT JOIN moz_openpages_temp t ON t.url = h.url
+ WHERE h.frecency <> 0
+ AND AUTOCOMPLETE_MATCH(:searchString, h.url,
+ IFNULL(btitle, h.title), tags,
+ h.visit_count, h.typed,
+ bookmarked, t.open_count,
+ :matchBehavior, :searchBehavior)
+ ${conditions}
+ ORDER BY h.frecency DESC, h.id DESC
+ LIMIT :maxResults`;
+ return query;
+ }
+
+ //////////////////////////////////////////////////////////////////////////////
+ //// Smart Getters
+
+ XPCOMUtils.defineLazyGetter(this, "_db", function() {
+ // Get a cloned, read-only version of the database. We'll only ever write
+ // to our own in-memory temp table, and having a cloned copy means we do not
+ // run the risk of our queries taking longer due to the main database
+ // connection performing a long-running task.
+ let db = PlacesUtils.history.DBConnection.clone(true);
+
+ // Autocomplete often fallbacks to a table scan due to lack of text indices.
+ // In such cases a larger cache helps reducing IO. The default Storage
+ // value is MAX_CACHE_SIZE_BYTES in storage/mozStorageConnection.cpp.
+ let stmt = db.createAsyncStatement("PRAGMA cache_size = -6144"); // 6MiB
+ stmt.executeAsync();
+ stmt.finalize();
+
+ // Create our in-memory tables for tab tracking.
+ initTempTable(db);
+
+ // Populate the table with current open pages cache contents.
+ if (this._openPagesCache.length > 0) {
+ // Avoid getter re-entrance from the _registerOpenPageQuery lazy getter.
+ let stmt = this._registerOpenPageQuery =
+ db.createAsyncStatement(this._registerOpenPageQuerySQL);
+ let params = stmt.newBindingParamsArray();
+ for (let i = 0; i < this._openPagesCache.length; i++) {
+ let bp = params.newBindingParams();
+ bp.bindByName("page_url", this._openPagesCache[i]);
+ params.addParams(bp);
+ }
+ stmt.bindParameters(params);
+ stmt.executeAsync();
+ stmt.finalize();
+ delete this._openPagesCache;
+ }
+
+ return db;
+ });
+
+ this._customQuery = (conditions = "") => {
+ return this._db.createAsyncStatement(baseQuery(conditions));
+ };
+
+ XPCOMUtils.defineLazyGetter(this, "_defaultQuery", function() {
+ return this._db.createAsyncStatement(baseQuery());
+ });
+
+ XPCOMUtils.defineLazyGetter(this, "_historyQuery", function() {
+ // Enforce ignoring the visit_count index, since the frecency one is much
+ // faster in this case. ANALYZE helps the query planner to figure out the
+ // faster path, but it may not have run yet.
+ return this._db.createAsyncStatement(baseQuery("AND +h.visit_count > 0"));
+ });
+
+ XPCOMUtils.defineLazyGetter(this, "_bookmarkQuery", function() {
+ return this._db.createAsyncStatement(baseQuery("AND bookmarked"));
+ });
+
+ XPCOMUtils.defineLazyGetter(this, "_tagsQuery", function() {
+ return this._db.createAsyncStatement(baseQuery("AND tags IS NOT NULL"));
+ });
+
+ XPCOMUtils.defineLazyGetter(this, "_openPagesQuery", function() {
+ return this._db.createAsyncStatement(
+ `SELECT t.url, t.url, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ :query_type, t.open_count, NULL
+ FROM moz_openpages_temp t
+ LEFT JOIN moz_places h ON h.url = t.url
+ WHERE h.id IS NULL
+ AND AUTOCOMPLETE_MATCH(:searchString, t.url, t.url, NULL,
+ NULL, NULL, NULL, t.open_count,
+ :matchBehavior, :searchBehavior)
+ ORDER BY t.ROWID DESC
+ LIMIT :maxResults`
+ );
+ });
+
+ XPCOMUtils.defineLazyGetter(this, "_typedQuery", function() {
+ return this._db.createAsyncStatement(baseQuery("AND h.typed = 1"));
+ });
+
+ XPCOMUtils.defineLazyGetter(this, "_adaptiveQuery", function() {
+ return this._db.createAsyncStatement(
+ `/* do not warn (bug 487789) */
+ SELECT h.url, h.title, f.url, ${kBookTagSQLFragment},
+ h.visit_count, h.typed, h.id, :query_type, t.open_count
+ FROM (
+ SELECT ROUND(
+ MAX(use_count) * (1 + (input = :search_string)), 1
+ ) AS rank, place_id
+ FROM moz_inputhistory
+ WHERE input BETWEEN :search_string AND :search_string || X'FFFF'
+ GROUP BY place_id
+ ) AS i
+ JOIN moz_places h ON h.id = i.place_id
+ LEFT JOIN moz_favicons f ON f.id = h.favicon_id
+ LEFT JOIN moz_openpages_temp t ON t.url = h.url
+ WHERE AUTOCOMPLETE_MATCH(NULL, h.url,
+ IFNULL(btitle, h.title), tags,
+ h.visit_count, h.typed, bookmarked,
+ t.open_count,
+ :matchBehavior, :searchBehavior)
+ ORDER BY rank DESC, h.frecency DESC`
+ );
+ });
+
+ XPCOMUtils.defineLazyGetter(this, "_keywordQuery", function() {
+ return this._db.createAsyncStatement(
+ `/* do not warn (bug 487787) */
+ SELECT REPLACE(h.url, '%s', :query_string) AS search_url, h.title,
+ IFNULL(f.url, (SELECT f.url
+ FROM moz_places
+ JOIN moz_favicons f ON f.id = favicon_id
+ WHERE rev_host = h.rev_host
+ ORDER BY frecency DESC
+ LIMIT 1)
+ ), 1, NULL, NULL, h.visit_count, h.typed, h.id,
+ :query_type, t.open_count
+ FROM moz_keywords k
+ JOIN moz_places h ON k.place_id = h.id
+ LEFT JOIN moz_favicons f ON f.id = h.favicon_id
+ LEFT JOIN moz_openpages_temp t ON t.url = search_url
+ WHERE k.keyword = LOWER(:keyword)`
+ );
+ });
+
+ this._registerOpenPageQuerySQL =
+ `INSERT OR REPLACE INTO moz_openpages_temp (url, open_count)
+ VALUES (:page_url,
+ IFNULL(
+ (
+ SELECT open_count + 1
+ FROM moz_openpages_temp
+ WHERE url = :page_url
+ ),
+ 1
+ )
+ )`;
+ XPCOMUtils.defineLazyGetter(this, "_registerOpenPageQuery", function() {
+ return this._db.createAsyncStatement(this._registerOpenPageQuerySQL);
+ });
+
+ XPCOMUtils.defineLazyGetter(this, "_unregisterOpenPageQuery", function() {
+ return this._db.createAsyncStatement(
+ `UPDATE moz_openpages_temp
+ SET open_count = open_count - 1
+ WHERE url = :page_url`
+ );
+ });
+
+ //////////////////////////////////////////////////////////////////////////////
+ //// Initialization
+
+ // load preferences
+ this._prefs = Cc["@mozilla.org/preferences-service;1"].
+ getService(Ci.nsIPrefService).
+ getBranch(kBrowserUrlbarBranch);
+ this._syncEnabledPref();
+ this._loadPrefs(true);
+
+ // register observers
+ this._os = Cc["@mozilla.org/observer-service;1"].
+ getService(Ci.nsIObserverService);
+ this._os.addObserver(this, kTopicShutdown, false);
+
+}
+
+nsPlacesAutoComplete.prototype = {
+ //////////////////////////////////////////////////////////////////////////////
+ //// nsIAutoCompleteSearch
+
+ startSearch: function PAC_startSearch(aSearchString, aSearchParam,
+ aPreviousResult, aListener)
+ {
+ // Stop the search in case the controller has not taken care of it.
+ this.stopSearch();
+
+ // Note: We don't use aPreviousResult to make sure ordering of results are
+ // consistent. See bug 412730 for more details.
+
+ // We want to store the original string with no leading or trailing
+ // whitespace for case sensitive searches.
+ this._originalSearchString = aSearchString.trim();
+
+ this._currentSearchString =
+ fixupSearchText(this._originalSearchString.toLowerCase());
+
+ let params = new Set(aSearchParam.split(" "));
+ this._enableActions = params.has("enable-actions");
+ this._disablePrivateActions = params.has("disable-private-actions");
+
+ this._listener = aListener;
+ let result = Cc["@mozilla.org/autocomplete/simple-result;1"].
+ createInstance(Ci.nsIAutoCompleteSimpleResult);
+ result.setSearchString(aSearchString);
+ result.setListener(this);
+ this._result = result;
+
+ // If we are not enabled, we need to return now.
+ if (!this._enabled) {
+ this._finishSearch(true);
+ return;
+ }
+
+ // Reset our search behavior to the default.
+ if (this._currentSearchString) {
+ this._behavior = this._defaultBehavior;
+ }
+ else {
+ this._behavior = this._emptySearchDefaultBehavior;
+ }
+ // For any given search, we run up to four queries:
+ // 1) keywords (this._keywordQuery)
+ // 2) adaptive learning (this._adaptiveQuery)
+ // 3) open pages not supported by history (this._openPagesQuery)
+ // 4) query from this._getSearch
+ // (1) only gets ran if we get any filtered tokens from this._getSearch,
+ // since if there are no tokens, there is nothing to match, so there is no
+ // reason to run the query).
+ let {query, tokens} =
+ this._getSearch(this._getUnfilteredSearchTokens(this._currentSearchString));
+ let queries = tokens.length ?
+ [this._getBoundKeywordQuery(tokens), this._getBoundAdaptiveQuery()] :
+ [this._getBoundAdaptiveQuery()];
+
+ if (this._hasBehavior("openpage")) {
+ queries.push(this._getBoundOpenPagesQuery(tokens));
+ }
+ queries.push(query);
+
+ // Start executing our queries.
+ this._telemetryStartTime = Date.now();
+ this._executeQueries(queries);
+
+ // Set up our persistent state for the duration of the search.
+ this._searchTokens = tokens;
+ this._usedPlaces = {};
+ },
+
+ stopSearch: function PAC_stopSearch()
+ {
+ // We need to cancel our searches so we do not get any [more] results.
+ // However, it's possible we haven't actually started any searches, so this
+ // method may throw because this._pendingQuery may be undefined.
+ if (this._pendingQuery) {
+ this._stopActiveQuery();
+ }
+
+ this._finishSearch(false);
+ },
+
+ //////////////////////////////////////////////////////////////////////////////
+ //// nsIAutoCompleteSimpleResultListener
+
+ onValueRemoved: function PAC_onValueRemoved(aResult, aURISpec, aRemoveFromDB)
+ {
+ if (aRemoveFromDB) {
+ PlacesUtils.history.removePage(NetUtil.newURI(aURISpec));
+ }
+ },
+
+ //////////////////////////////////////////////////////////////////////////////
+ //// mozIPlacesAutoComplete
+
+ // If the connection has not yet been started, use this local cache. This
+ // prevents autocomplete from initing the database till the first search.
+ _openPagesCache: [],
+ registerOpenPage: function PAC_registerOpenPage(aURI)
+ {
+ if (!this._databaseInitialized) {
+ this._openPagesCache.push(aURI.spec);
+ return;
+ }
+
+ let stmt = this._registerOpenPageQuery;
+ stmt.params.page_url = aURI.spec;
+ stmt.executeAsync();
+ },
+
+ unregisterOpenPage: function PAC_unregisterOpenPage(aURI)
+ {
+ if (!this._databaseInitialized) {
+ let index = this._openPagesCache.indexOf(aURI.spec);
+ if (index != -1) {
+ this._openPagesCache.splice(index, 1);
+ }
+ return;
+ }
+
+ let stmt = this._unregisterOpenPageQuery;
+ stmt.params.page_url = aURI.spec;
+ stmt.executeAsync();
+ },
+
+ //////////////////////////////////////////////////////////////////////////////
+ //// mozIStorageStatementCallback
+
+ handleResult: function PAC_handleResult(aResultSet)
+ {
+ let row, haveMatches = false;
+ while ((row = aResultSet.getNextRow())) {
+ let match = this._processRow(row);
+ haveMatches = haveMatches || match;
+
+ if (this._result.matchCount == this._maxRichResults) {
+ // We have enough results, so stop running our search.
+ this._stopActiveQuery();
+
+ // And finish our search.
+ this._finishSearch(true);
+ return;
+ }
+
+ }
+
+ // Notify about results if we've gotten them.
+ if (haveMatches) {
+ this._notifyResults(true);
+ }
+ },
+
+ handleError: function PAC_handleError(aError)
+ {
+ Components.utils.reportError("Places AutoComplete: An async statement encountered an " +
+ "error: " + aError.result + ", '" + aError.message + "'");
+ },
+
+ handleCompletion: function PAC_handleCompletion(aReason)
+ {
+ // If we have already finished our search, we should bail out early.
+ if (this.isSearchComplete()) {
+ return;
+ }
+
+ // If we do not have enough results, and our match type is
+ // MATCH_BOUNDARY_ANYWHERE, search again with MATCH_ANYWHERE to get more
+ // results.
+ if (this._matchBehavior == MATCH_BOUNDARY_ANYWHERE &&
+ this._result.matchCount < this._maxRichResults && !this._secondPass) {
+ this._secondPass = true;
+ let queries = [
+ this._getBoundAdaptiveQuery(MATCH_ANYWHERE),
+ this._getBoundSearchQuery(MATCH_ANYWHERE, this._searchTokens),
+ ];
+ this._executeQueries(queries);
+ return;
+ }
+
+ this._finishSearch(true);
+ },
+
+ //////////////////////////////////////////////////////////////////////////////
+ //// nsIObserver
+
+ observe: function PAC_observe(aSubject, aTopic, aData)
+ {
+ if (aTopic == kTopicShutdown) {
+ this._os.removeObserver(this, kTopicShutdown);
+
+ // Remove our preference observer.
+ this._prefs.removeObserver("", this);
+ delete this._prefs;
+
+ // Finalize the statements that we have used.
+ let stmts = [
+ "_defaultQuery",
+ "_historyQuery",
+ "_bookmarkQuery",
+ "_tagsQuery",
+ "_openPagesQuery",
+ "_typedQuery",
+ "_adaptiveQuery",
+ "_keywordQuery",
+ "_registerOpenPageQuery",
+ "_unregisterOpenPageQuery",
+ ];
+ for (let i = 0; i < stmts.length; i++) {
+ // We do not want to create any query we haven't already created, so
+ // see if it is a getter first.
+ if (Object.getOwnPropertyDescriptor(this, stmts[i]).value !== undefined) {
+ this[stmts[i]].finalize();
+ }
+ }
+
+ if (this._databaseInitialized) {
+ this._db.asyncClose();
+ }
+ }
+ else if (aTopic == kPrefChanged) {
+ // Avoid re-entrancy when flipping linked preferences.
+ if (this._ignoreNotifications)
+ return;
+ this._ignoreNotifications = true;
+ this._loadPrefs(false, aTopic, aData);
+ this._ignoreNotifications = false;
+ }
+ },
+
+ //////////////////////////////////////////////////////////////////////////////
+ //// nsPlacesAutoComplete
+
+ get _databaseInitialized() {
+ return Object.getOwnPropertyDescriptor(this, "_db").value !== undefined;
+ },
+
+ /**
+ * Generates the tokens used in searching from a given string.
+ *
+ * @param aSearchString
+ * The string to generate tokens from.
+ * @return an array of tokens.
+ */
+ _getUnfilteredSearchTokens: function PAC_unfilteredSearchTokens(aSearchString)
+ {
+ // Calling split on an empty string will return an array containing one
+ // empty string. We don't want that, as it'll break our logic, so return an
+ // empty array then.
+ return aSearchString.length ? aSearchString.split(" ") : [];
+ },
+
+ /**
+ * Properly cleans up when searching is completed.
+ *
+ * @param aNotify
+ * Indicates if we should notify the AutoComplete listener about our
+ * results or not.
+ */
+ _finishSearch: function PAC_finishSearch(aNotify)
+ {
+ // Notify about results if we are supposed to.
+ if (aNotify) {
+ this._notifyResults(false);
+ }
+
+ // Clear our state
+ delete this._originalSearchString;
+ delete this._currentSearchString;
+ delete this._strippedPrefix;
+ delete this._searchTokens;
+ delete this._listener;
+ delete this._result;
+ delete this._usedPlaces;
+ delete this._pendingQuery;
+ this._secondPass = false;
+ this._enableActions = false;
+ },
+
+ /**
+ * Executes the given queries asynchronously.
+ *
+ * @param aQueries
+ * The queries to execute.
+ */
+ _executeQueries: function PAC_executeQueries(aQueries)
+ {
+ // Because we might get a handleCompletion for canceled queries, we want to
+ // filter out queries we no longer care about (described in the
+ // handleCompletion implementation of AutoCompleteStatementCallbackWrapper).
+
+ // Create our wrapper object and execute the queries.
+ let wrapper = new AutoCompleteStatementCallbackWrapper(this, this, this._db);
+ this._pendingQuery = wrapper.executeAsync(aQueries);
+ },
+
+ /**
+ * Stops executing our active query.
+ */
+ _stopActiveQuery: function PAC_stopActiveQuery()
+ {
+ this._pendingQuery.cancel();
+ delete this._pendingQuery;
+ },
+
+ /**
+ * Notifies the listener about results.
+ *
+ * @param aSearchOngoing
+ * Indicates if the search is ongoing or not.
+ */
+ _notifyResults: function PAC_notifyResults(aSearchOngoing)
+ {
+ let result = this._result;
+ let resultCode = result.matchCount ? "RESULT_SUCCESS" : "RESULT_NOMATCH";
+ if (aSearchOngoing) {
+ resultCode += "_ONGOING";
+ }
+ result.setSearchResult(Ci.nsIAutoCompleteResult[resultCode]);
+ this._listener.onSearchResult(this, result);
+ if (this._telemetryStartTime) {
+ let elapsed = Date.now() - this._telemetryStartTime;
+ if (elapsed > 50) {
+ try {
+ Services.telemetry
+ .getHistogramById("PLACES_AUTOCOMPLETE_1ST_RESULT_TIME_MS")
+ .add(elapsed);
+ } catch (ex) {
+ Components.utils.reportError("Unable to report telemetry.");
+ }
+ }
+ this._telemetryStartTime = null;
+ }
+ },
+
+ /**
+ * Synchronize suggest.* prefs with autocomplete.enabled.
+ */
+ _syncEnabledPref: function PAC_syncEnabledPref()
+ {
+ let suggestPrefs = ["suggest.history", "suggest.bookmark", "suggest.openpage"];
+ let types = ["History", "Bookmark", "Openpage"];
+
+ this._enabled = safePrefGetter(this._prefs, kBrowserUrlbarAutocompleteEnabledPref,
+ true);
+ this._suggestHistory = safePrefGetter(this._prefs, "suggest.history", true);
+ this._suggestBookmark = safePrefGetter(this._prefs, "suggest.bookmark", true);
+ this._suggestOpenpage = safePrefGetter(this._prefs, "suggest.openpage", true);
+
+ if (this._enabled) {
+ // If the autocomplete preference is active, activate all suggest
+ // preferences only if all of them are false.
+ if (types.every(type => this["_suggest" + type] == false)) {
+ for (let type of suggestPrefs) {
+ this._prefs.setBoolPref(type, true);
+ }
+ }
+ } else {
+ // If the preference was deactivated, deactivate all suggest preferences.
+ for (let type of suggestPrefs) {
+ this._prefs.setBoolPref(type, false);
+ }
+ }
+ },
+
+ /**
+ * Loads the preferences that we care about.
+ *
+ * @param [optional] aRegisterObserver
+ * Indicates if the preference observer should be added or not. The
+ * default value is false.
+ * @param [optional] aTopic
+ * Observer's topic, if any.
+ * @param [optional] aSubject
+ * Observer's subject, if any.
+ */
+ _loadPrefs: function PAC_loadPrefs(aRegisterObserver, aTopic, aData)
+ {
+ // Avoid race conditions with UnifiedComplete component.
+ if (aData && !isUnifiedCompleteInstantiated()) {
+ // Synchronize suggest.* prefs with autocomplete.enabled.
+ if (aData == kBrowserUrlbarAutocompleteEnabledPref) {
+ this._syncEnabledPref();
+ } else if (aData.startsWith("suggest.")) {
+ let suggestPrefs = ["suggest.history", "suggest.bookmark", "suggest.openpage"];
+ this._prefs.setBoolPref(kBrowserUrlbarAutocompleteEnabledPref,
+ suggestPrefs.some(pref => safePrefGetter(this._prefs, pref, true)));
+ }
+ }
+
+ this._enabled = safePrefGetter(this._prefs,
+ kBrowserUrlbarAutocompleteEnabledPref,
+ true);
+ this._matchBehavior = safePrefGetter(this._prefs,
+ "matchBehavior",
+ MATCH_BOUNDARY_ANYWHERE);
+ this._filterJavaScript = safePrefGetter(this._prefs, "filter.javascript", true);
+ this._maxRichResults = safePrefGetter(this._prefs, "maxRichResults", 25);
+ this._restrictHistoryToken = safePrefGetter(this._prefs,
+ "restrict.history", "^");
+ this._restrictBookmarkToken = safePrefGetter(this._prefs,
+ "restrict.bookmark", "*");
+ this._restrictTypedToken = safePrefGetter(this._prefs, "restrict.typed", "~");
+ this._restrictTagToken = safePrefGetter(this._prefs, "restrict.tag", "+");
+ this._restrictOpenPageToken = safePrefGetter(this._prefs,
+ "restrict.openpage", "%");
+ this._matchTitleToken = safePrefGetter(this._prefs, "match.title", "#");
+ this._matchURLToken = safePrefGetter(this._prefs, "match.url", "@");
+
+ this._suggestHistory = safePrefGetter(this._prefs, "suggest.history", true);
+ this._suggestBookmark = safePrefGetter(this._prefs, "suggest.bookmark", true);
+ this._suggestOpenpage = safePrefGetter(this._prefs, "suggest.openpage", true);
+ this._suggestTyped = safePrefGetter(this._prefs, "suggest.history.onlyTyped", false);
+
+ // If history is not set, onlyTyped value should be ignored.
+ if (!this._suggestHistory) {
+ this._suggestTyped = false;
+ }
+ let types = ["History", "Bookmark", "Openpage", "Typed"];
+ this._defaultBehavior = types.reduce((memo, type) => {
+ let prefValue = this["_suggest" + type];
+ return memo | (prefValue &&
+ Ci.mozIPlacesAutoComplete["BEHAVIOR_" + type.toUpperCase()]);
+ }, 0);
+
+ // Further restrictions to apply for "empty searches" (i.e. searches for "").
+ // The empty behavior is typed history, if history is enabled. Otherwise,
+ // it is bookmarks, if they are enabled. If both history and bookmarks are disabled,
+ // it defaults to open pages.
+ this._emptySearchDefaultBehavior = Ci.mozIPlacesAutoComplete.BEHAVIOR_RESTRICT;
+ if (this._suggestHistory) {
+ this._emptySearchDefaultBehavior |= Ci.mozIPlacesAutoComplete.BEHAVIOR_HISTORY |
+ Ci.mozIPlacesAutoComplete.BEHAVIOR_TYPED;
+ } else if (this._suggestBookmark) {
+ this._emptySearchDefaultBehavior |= Ci.mozIPlacesAutoComplete.BEHAVIOR_BOOKMARK;
+ } else {
+ this._emptySearchDefaultBehavior |= Ci.mozIPlacesAutoComplete.BEHAVIOR_OPENPAGE;
+ }
+
+ // Validate matchBehavior; default to MATCH_BOUNDARY_ANYWHERE.
+ if (this._matchBehavior != MATCH_ANYWHERE &&
+ this._matchBehavior != MATCH_BOUNDARY &&
+ this._matchBehavior != MATCH_BEGINNING) {
+ this._matchBehavior = MATCH_BOUNDARY_ANYWHERE;
+ }
+ // register observer
+ if (aRegisterObserver) {
+ this._prefs.addObserver("", this, false);
+ }
+ },
+
+ /**
+ * Given an array of tokens, this function determines which query should be
+ * ran. It also removes any special search tokens.
+ *
+ * @param aTokens
+ * An array of search tokens.
+ * @return an object with two properties:
+ * query: the correctly optimized, bound query to search the database
+ * with.
+ * tokens: the filtered list of tokens to search with.
+ */
+ _getSearch: function PAC_getSearch(aTokens)
+ {
+ let foundToken = false;
+ let restrict = (behavior) => {
+ if (!foundToken) {
+ this._behavior = 0;
+ this._setBehavior("restrict");
+ foundToken = true;
+ }
+ this._setBehavior(behavior);
+ };
+
+ // Set the proper behavior so our call to _getBoundSearchQuery gives us the
+ // correct query.
+ for (let i = aTokens.length - 1; i >= 0; i--) {
+ switch (aTokens[i]) {
+ case this._restrictHistoryToken:
+ restrict("history");
+ break;
+ case this._restrictBookmarkToken:
+ restrict("bookmark");
+ break;
+ case this._restrictTagToken:
+ restrict("tag");
+ break;
+ case this._restrictOpenPageToken:
+ if (!this._enableActions) {
+ continue;
+ }
+ restrict("openpage");
+ break;
+ case this._matchTitleToken:
+ restrict("title");
+ break;
+ case this._matchURLToken:
+ restrict("url");
+ break;
+ case this._restrictTypedToken:
+ restrict("typed");
+ break;
+ default:
+ // We do not want to remove the token if we did not match.
+ continue;
+ }
+
+ aTokens.splice(i, 1);
+ }
+
+ // Set the right JavaScript behavior based on our preference. Note that the
+ // preference is whether or not we should filter JavaScript, and the
+ // behavior is if we should search it or not.
+ if (!this._filterJavaScript) {
+ this._setBehavior("javascript");
+ }
+
+ return {
+ query: this._getBoundSearchQuery(this._matchBehavior, aTokens),
+ tokens: aTokens
+ };
+ },
+
+ /**
+ * @return a string consisting of the search query to be used based on the
+ * previously set urlbar suggestion preferences.
+ */
+ _getSuggestionPrefQuery: function PAC_getSuggestionPrefQuery()
+ {
+ if (!this._hasBehavior("restrict") && this._hasBehavior("history") &&
+ this._hasBehavior("bookmark")) {
+ return this._hasBehavior("typed") ? this._customQuery("AND h.typed = 1")
+ : this._defaultQuery;
+ }
+ let conditions = [];
+ if (this._hasBehavior("history")) {
+ // Enforce ignoring the visit_count index, since the frecency one is much
+ // faster in this case. ANALYZE helps the query planner to figure out the
+ // faster path, but it may not have up-to-date information yet.
+ conditions.push("+h.visit_count > 0");
+ }
+ if (this._hasBehavior("typed")) {
+ conditions.push("h.typed = 1");
+ }
+ if (this._hasBehavior("bookmark")) {
+ conditions.push("bookmarked");
+ }
+ if (this._hasBehavior("tag")) {
+ conditions.push("tags NOTNULL");
+ }
+
+ return conditions.length ? this._customQuery("AND " + conditions.join(" AND "))
+ : this._defaultQuery;
+ },
+
+ /**
+ * Obtains the search query to be used based on the previously set search
+ * behaviors (accessed by this._hasBehavior). The query is bound and ready to
+ * execute.
+ *
+ * @param aMatchBehavior
+ * How this query should match its tokens to the search string.
+ * @param aTokens
+ * An array of search tokens.
+ * @return the correctly optimized query to search the database with and the
+ * new list of tokens to search with. The query has all the needed
+ * parameters bound, so consumers can execute it without doing any
+ * additional work.
+ */
+ _getBoundSearchQuery: function PAC_getBoundSearchQuery(aMatchBehavior,
+ aTokens)
+ {
+ let query = this._getSuggestionPrefQuery();
+
+ // Bind the needed parameters to the query so consumers can use it.
+ let params = query.params;
+ params.parent = PlacesUtils.tagsFolderId;
+ params.query_type = kQueryTypeFiltered;
+ params.matchBehavior = aMatchBehavior;
+ params.searchBehavior = this._behavior;
+
+ // We only want to search the tokens that we are left with - not the
+ // original search string.
+ params.searchString = aTokens.join(" ");
+
+ // Limit the query to the the maximum number of desired results.
+ // This way we can avoid doing more work than needed.
+ params.maxResults = this._maxRichResults;
+
+ return query;
+ },
+
+ _getBoundOpenPagesQuery: function PAC_getBoundOpenPagesQuery(aTokens)
+ {
+ let query = this._openPagesQuery;
+
+ // Bind the needed parameters to the query so consumers can use it.
+ let params = query.params;
+ params.query_type = kQueryTypeFiltered;
+ params.matchBehavior = this._matchBehavior;
+ params.searchBehavior = this._behavior;
+
+ // We only want to search the tokens that we are left with - not the
+ // original search string.
+ params.searchString = aTokens.join(" ");
+ params.maxResults = this._maxRichResults;
+
+ return query;
+ },
+
+ /**
+ * Obtains the keyword query with the properly bound parameters.
+ *
+ * @param aTokens
+ * The array of search tokens to check against.
+ * @return the bound keyword query.
+ */
+ _getBoundKeywordQuery: function PAC_getBoundKeywordQuery(aTokens)
+ {
+ // The keyword is the first word in the search string, with the parameters
+ // following it.
+ let searchString = this._originalSearchString;
+ let queryString = "";
+ let queryIndex = searchString.indexOf(" ");
+ if (queryIndex != -1) {
+ queryString = searchString.substring(queryIndex + 1);
+ }
+ // We need to escape the parameters as if they were the query in a URL
+ queryString = encodeURIComponent(queryString).replace(/%20/g, "+");
+
+ // The first word could be a keyword, so that's what we'll search.
+ let keyword = aTokens[0];
+
+ let query = this._keywordQuery;
+ let params = query.params;
+ params.keyword = keyword;
+ params.query_string = queryString;
+ params.query_type = kQueryTypeKeyword;
+
+ return query;
+ },
+
+ /**
+ * Obtains the adaptive query with the properly bound parameters.
+ *
+ * @return the bound adaptive query.
+ */
+ _getBoundAdaptiveQuery: function PAC_getBoundAdaptiveQuery(aMatchBehavior)
+ {
+ // If we were not given a match behavior, use the stored match behavior.
+ if (arguments.length == 0) {
+ aMatchBehavior = this._matchBehavior;
+ }
+
+ let query = this._adaptiveQuery;
+ let params = query.params;
+ params.parent = PlacesUtils.tagsFolderId;
+ params.search_string = this._currentSearchString;
+ params.query_type = kQueryTypeFiltered;
+ params.matchBehavior = aMatchBehavior;
+ params.searchBehavior = this._behavior;
+
+ return query;
+ },
+
+ /**
+ * Processes a mozIStorageRow to generate the proper data for the AutoComplete
+ * result. This will add an entry to the current result if it matches the
+ * criteria.
+ *
+ * @param aRow
+ * The row to process.
+ * @return true if the row is accepted, and false if not.
+ */
+ _processRow: function PAC_processRow(aRow)
+ {
+ // Before we do any work, make sure this entry isn't already in our results.
+ let entryId = aRow.getResultByIndex(kQueryIndexPlaceId);
+ let escapedEntryURL = aRow.getResultByIndex(kQueryIndexURL);
+ let openPageCount = aRow.getResultByIndex(kQueryIndexOpenPageCount) || 0;
+
+ // If actions are enabled and the page is open, add only the switch-to-tab
+ // result. Otherwise, add the normal result.
+ let [url, action] = this._enableActions && openPageCount > 0 && this._hasBehavior("openpage") ?
+ ["moz-action:switchtab," + escapedEntryURL, "action "] :
+ [escapedEntryURL, ""];
+
+ if (this._inResults(entryId, url)) {
+ return false;
+ }
+
+ let entryTitle = aRow.getResultByIndex(kQueryIndexTitle) || "";
+ let entryFavicon = aRow.getResultByIndex(kQueryIndexFaviconURL) || "";
+ let entryBookmarked = aRow.getResultByIndex(kQueryIndexBookmarked);
+ let entryBookmarkTitle = entryBookmarked ?
+ aRow.getResultByIndex(kQueryIndexBookmarkTitle) : null;
+ let entryTags = aRow.getResultByIndex(kQueryIndexTags) || "";
+
+ // Always prefer the bookmark title unless it is empty
+ let title = entryBookmarkTitle || entryTitle;
+
+ let style;
+ if (aRow.getResultByIndex(kQueryIndexQueryType) == kQueryTypeKeyword) {
+ style = "keyword";
+ title = NetUtil.newURI(escapedEntryURL).host;
+ }
+
+ // We will always prefer to show tags if we have them.
+ let showTags = !!entryTags;
+
+ // However, we'll act as if a page is not bookmarked if the user wants
+ // only history and not bookmarks and there are no tags.
+ if (this._hasBehavior("history") && !this._hasBehavior("bookmark") &&
+ !showTags) {
+ showTags = false;
+ style = "favicon";
+ }
+
+ // If we have tags and should show them, we need to add them to the title.
+ if (showTags) {
+ title += kTitleTagsSeparator + entryTags;
+ }
+ // We have to determine the right style to display. Tags show the tag icon,
+ // bookmarks get the bookmark icon, and keywords get the keyword icon. If
+ // the result does not fall into any of those, it just gets the favicon.
+ if (!style) {
+ // It is possible that we already have a style set (from a keyword
+ // search or because of the user's preferences), so only set it if we
+ // haven't already done so.
+ if (showTags) {
+ style = "tag";
+ }
+ else if (entryBookmarked) {
+ style = "bookmark";
+ }
+ else {
+ style = "favicon";
+ }
+ }
+
+ this._addToResults(entryId, url, title, entryFavicon, action + style);
+ return true;
+ },
+
+ /**
+ * Checks to see if the given place has already been added to the results.
+ *
+ * @param aPlaceId
+ * The place id to check for, may be null.
+ * @param aUrl
+ * The url to check for.
+ * @return true if the place has been added, false otherwise.
+ *
+ * @note Must check both the id and the url for a negative match, since
+ * autocomplete may run in the middle of a new page addition. In such
+ * a case the switch-to-tab query would hash the page by url, then a
+ * next query, running after the page addition, would hash it by id.
+ * It's not possible to just rely on url though, since keywords
+ * dynamically modify the url to include their search string.
+ */
+ _inResults: function PAC_inResults(aPlaceId, aUrl)
+ {
+ if (aPlaceId && aPlaceId in this._usedPlaces) {
+ return true;
+ }
+ return aUrl in this._usedPlaces;
+ },
+
+ /**
+ * Adds a result to the AutoComplete results. Also tracks that we've added
+ * this place_id into the result set.
+ *
+ * @param aPlaceId
+ * The place_id of the item to be added to the result set. This is
+ * used by _inResults.
+ * @param aURISpec
+ * The URI spec for the entry.
+ * @param aTitle
+ * The title to give the entry.
+ * @param aFaviconSpec
+ * The favicon to give to the entry.
+ * @param aStyle
+ * Indicates how the entry should be styled when displayed.
+ */
+ _addToResults: function PAC_addToResults(aPlaceId, aURISpec, aTitle,
+ aFaviconSpec, aStyle)
+ {
+ // Add this to our internal tracker to ensure duplicates do not end up in
+ // the result. _usedPlaces is an Object that is being used as a set.
+ // Not all entries have a place id, thus we fallback to the url for them.
+ // We cannot use only the url since keywords entries are modified to
+ // include the search string, and would be returned multiple times. Ids
+ // are faster too.
+ this._usedPlaces[aPlaceId || aURISpec] = true;
+
+ // Obtain the favicon for this URI.
+ let favicon;
+ if (aFaviconSpec) {
+ let uri = NetUtil.newURI(aFaviconSpec);
+ favicon = PlacesUtils.favicons.getFaviconLinkForIcon(uri).spec;
+ }
+ favicon = favicon || PlacesUtils.favicons.defaultFavicon.spec;
+
+ this._result.appendMatch(aURISpec, aTitle, favicon, aStyle);
+ },
+
+ /**
+ * Determines if the specified AutoComplete behavior is set.
+ *
+ * @param aType
+ * The behavior type to test for.
+ * @return true if the behavior is set, false otherwise.
+ */
+ _hasBehavior: function PAC_hasBehavior(aType)
+ {
+ let behavior = Ci.mozIPlacesAutoComplete["BEHAVIOR_" + aType.toUpperCase()];
+
+ if (this._disablePrivateActions &&
+ behavior == Ci.mozIPlacesAutoComplete.BEHAVIOR_OPENPAGE) {
+ return false;
+ }
+
+ return this._behavior & behavior;
+ },
+
+ /**
+ * Enables the desired AutoComplete behavior.
+ *
+ * @param aType
+ * The behavior type to set.
+ */
+ _setBehavior: function PAC_setBehavior(aType)
+ {
+ this._behavior |=
+ Ci.mozIPlacesAutoComplete["BEHAVIOR_" + aType.toUpperCase()];
+ },
+
+ /**
+ * Determines if we are done searching or not.
+ *
+ * @return true if we have completed searching, false otherwise.
+ */
+ isSearchComplete: function PAC_isSearchComplete()
+ {
+ // If _pendingQuery is null, we should no longer do any work since we have
+ // already called _finishSearch. This means we completed our search.
+ return this._pendingQuery == null;
+ },
+
+ /**
+ * Determines if the given handle of a pending statement is a pending search
+ * or not.
+ *
+ * @param aHandle
+ * A mozIStoragePendingStatement to check and see if we are waiting for
+ * results from it still.
+ * @return true if it is a pending query, false otherwise.
+ */
+ isPendingSearch: function PAC_isPendingSearch(aHandle)
+ {
+ return this._pendingQuery == aHandle;
+ },
+
+ //////////////////////////////////////////////////////////////////////////////
+ //// nsISupports
+
+ classID: Components.ID("d0272978-beab-4adc-a3d4-04b76acfa4e7"),
+
+ _xpcom_factory: XPCOMUtils.generateSingletonFactory(nsPlacesAutoComplete),
+
+ QueryInterface: XPCOMUtils.generateQI([
+ Ci.nsIAutoCompleteSearch,
+ Ci.nsIAutoCompleteSimpleResultListener,
+ Ci.mozIPlacesAutoComplete,
+ Ci.mozIStorageStatementCallback,
+ Ci.nsIObserver,
+ Ci.nsISupportsWeakReference,
+ ])
+};
+
+////////////////////////////////////////////////////////////////////////////////
+//// urlInlineComplete class
+//// component @mozilla.org/autocomplete/search;1?name=urlinline
+
+function urlInlineComplete()
+{
+ this._loadPrefs(true);
+ Services.obs.addObserver(this, kTopicShutdown, true);
+}
+
+urlInlineComplete.prototype = {
+
+/////////////////////////////////////////////////////////////////////////////////
+//// Database and query getters
+
+ __db: null,
+
+ get _db()
+ {
+ if (!this.__db && this._autofillEnabled) {
+ this.__db = PlacesUtils.history.DBConnection.clone(true);
+ }
+ return this.__db;
+ },
+
+ __hostQuery: null,
+
+ get _hostQuery()
+ {
+ if (!this.__hostQuery) {
+ // Add a trailing slash at the end of the hostname, since we always
+ // want to complete up to and including a URL separator.
+ this.__hostQuery = this._db.createAsyncStatement(
+ `/* do not warn (bug no): could index on (typed,frecency) but not worth it */
+ SELECT host || '/', prefix || host || '/'
+ FROM moz_hosts
+ WHERE host BETWEEN :search_string AND :search_string || X'FFFF'
+ AND frecency <> 0
+ ${this._autofillTyped ? "AND typed = 1" : ""}
+ ORDER BY frecency DESC
+ LIMIT 1`
+ );
+ }
+ return this.__hostQuery;
+ },
+
+ __urlQuery: null,
+
+ get _urlQuery()
+ {
+ if (!this.__urlQuery) {
+ this.__urlQuery = this._db.createAsyncStatement(
+ `/* do not warn (bug no): can't use an index */
+ SELECT h.url
+ FROM moz_places h
+ WHERE h.frecency <> 0
+ ${this._autofillTyped ? "AND h.typed = 1 " : ""}
+ AND AUTOCOMPLETE_MATCH(:searchString, h.url,
+ h.title, '',
+ h.visit_count, h.typed, 0, 0,
+ :matchBehavior, :searchBehavior)
+ ORDER BY h.frecency DESC, h.id DESC
+ LIMIT 1`
+ );
+ }
+ return this.__urlQuery;
+ },
+
+ //////////////////////////////////////////////////////////////////////////////
+ //// nsIAutoCompleteSearch
+
+ startSearch: function UIC_startSearch(aSearchString, aSearchParam,
+ aPreviousResult, aListener)
+ {
+ // Stop the search in case the controller has not taken care of it.
+ if (this._pendingQuery) {
+ this.stopSearch();
+ }
+
+ let pendingSearch = this._pendingSearch = {};
+
+ // We want to store the original string with no leading or trailing
+ // whitespace for case sensitive searches.
+ this._originalSearchString = aSearchString;
+ this._currentSearchString =
+ fixupSearchText(this._originalSearchString.toLowerCase());
+ // The protocol and the host are lowercased by nsIURI, so it's fine to
+ // lowercase the typed prefix to add it back to the results later.
+ this._strippedPrefix = this._originalSearchString.slice(
+ 0, this._originalSearchString.length - this._currentSearchString.length
+ ).toLowerCase();
+
+ this._result = Cc["@mozilla.org/autocomplete/simple-result;1"].
+ createInstance(Ci.nsIAutoCompleteSimpleResult);
+ this._result.setSearchString(aSearchString);
+ this._result.setTypeAheadResult(true);
+
+ this._listener = aListener;
+
+ Task.spawn(function* () {
+ // Don't autoFill if the search term is recognized as a keyword, otherwise
+ // it will override default keywords behavior. Note that keywords are
+ // hashed on first use, so while the first query may delay a little bit,
+ // next ones will just hit the memory hash.
+ let dontAutoFill = this._currentSearchString.length == 0 || !this._db ||
+ (yield PlacesUtils.keywords.fetch(this._currentSearchString));
+ if (this._pendingSearch != pendingSearch)
+ return;
+ if (dontAutoFill) {
+ this._finishSearch();
+ return;
+ }
+
+ // Don't try to autofill if the search term includes any whitespace.
+ // This may confuse completeDefaultIndex cause the AUTOCOMPLETE_MATCH
+ // tokenizer ends up trimming the search string and returning a value
+ // that doesn't match it, or is even shorter.
+ if (/\s/.test(this._currentSearchString)) {
+ this._finishSearch();
+ return;
+ }
+
+ // Hosts have no "/" in them.
+ let lastSlashIndex = this._currentSearchString.lastIndexOf("/");
+
+ // Search only URLs if there's a slash in the search string...
+ if (lastSlashIndex != -1) {
+ // ...but not if it's exactly at the end of the search string.
+ if (lastSlashIndex < this._currentSearchString.length - 1)
+ this._queryURL();
+ else
+ this._finishSearch();
+ return;
+ }
+
+ // Do a synchronous search on the table of hosts.
+ let query = this._hostQuery;
+ query.params.search_string = this._currentSearchString.toLowerCase();
+ // This is just to measure the delay to reach the UI, not the query time.
+ TelemetryStopwatch.start(DOMAIN_QUERY_TELEMETRY);
+ let wrapper = new AutoCompleteStatementCallbackWrapper(this, {
+ handleResult: aResultSet => {
+ if (this._pendingSearch != pendingSearch)
+ return;
+ let row = aResultSet.getNextRow();
+ let trimmedHost = row.getResultByIndex(0);
+ let untrimmedHost = row.getResultByIndex(1);
+ // If the untrimmed value doesn't preserve the user's input just
+ // ignore it and complete to the found host.
+ if (untrimmedHost &&
+ !untrimmedHost.toLowerCase().includes(this._originalSearchString.toLowerCase())) {
+ untrimmedHost = null;
+ }
+
+ this._result.appendMatch(this._strippedPrefix + trimmedHost, "", "", "", untrimmedHost);
+
+ // handleCompletion() will cause the result listener to be called, and
+ // will display the result in the UI.
+ },
+
+ handleError: aError => {
+ Components.utils.reportError(
+ "URL Inline Complete: An async statement encountered an " +
+ "error: " + aError.result + ", '" + aError.message + "'");
+ },
+
+ handleCompletion: aReason => {
+ if (this._pendingSearch != pendingSearch)
+ return;
+ TelemetryStopwatch.finish(DOMAIN_QUERY_TELEMETRY);
+ this._finishSearch();
+ }
+ }, this._db);
+ this._pendingQuery = wrapper.executeAsync([query]);
+ }.bind(this));
+ },
+
+ /**
+ * Execute an asynchronous search through places, and complete
+ * up to the next URL separator.
+ */
+ _queryURL: function UIC__queryURL()
+ {
+ // The URIs in the database are fixed up, so we can match on a lowercased
+ // host, but the path must be matched in a case sensitive way.
+ let pathIndex =
+ this._originalSearchString.indexOf("/", this._strippedPrefix.length);
+ this._currentSearchString = fixupSearchText(
+ this._originalSearchString.slice(0, pathIndex).toLowerCase() +
+ this._originalSearchString.slice(pathIndex)
+ );
+
+ // Within the standard autocomplete query, we only search the beginning
+ // of URLs for 1 result.
+ let query = this._urlQuery;
+ let params = query.params;
+ params.matchBehavior = MATCH_BEGINNING_CASE_SENSITIVE;
+ params.searchBehavior |= Ci.mozIPlacesAutoComplete.BEHAVIOR_HISTORY |
+ Ci.mozIPlacesAutoComplete.BEHAVIOR_TYPED |
+ Ci.mozIPlacesAutoComplete.BEHAVIOR_URL;
+ params.searchString = this._currentSearchString;
+
+ // Execute the query.
+ let wrapper = new AutoCompleteStatementCallbackWrapper(this, {
+ handleResult: aResultSet => {
+ let row = aResultSet.getNextRow();
+ let value = row.getResultByIndex(0);
+ let url = fixupSearchText(value);
+
+ let prefix = value.slice(0, value.length - stripPrefix(value).length);
+
+ // We must complete the URL up to the next separator (which is /, ? or #).
+ let separatorIndex = url.slice(this._currentSearchString.length)
+ .search(/[\/\?\#]/);
+ if (separatorIndex != -1) {
+ separatorIndex += this._currentSearchString.length;
+ if (url[separatorIndex] == "/") {
+ separatorIndex++; // Include the "/" separator
+ }
+ url = url.slice(0, separatorIndex);
+ }
+
+ // Add the result.
+ // If the untrimmed value doesn't preserve the user's input just
+ // ignore it and complete to the found url.
+ let untrimmedURL = prefix + url;
+ if (untrimmedURL &&
+ !untrimmedURL.toLowerCase().includes(this._originalSearchString.toLowerCase())) {
+ untrimmedURL = null;
+ }
+
+ this._result.appendMatch(this._strippedPrefix + url, "", "", "", untrimmedURL);
+
+ // handleCompletion() will cause the result listener to be called, and
+ // will display the result in the UI.
+ },
+
+ handleError: aError => {
+ Components.utils.reportError(
+ "URL Inline Complete: An async statement encountered an " +
+ "error: " + aError.result + ", '" + aError.message + "'");
+ },
+
+ handleCompletion: aReason => {
+ this._finishSearch();
+ }
+ }, this._db);
+ this._pendingQuery = wrapper.executeAsync([query]);
+ },
+
+ stopSearch: function UIC_stopSearch()
+ {
+ delete this._originalSearchString;
+ delete this._currentSearchString;
+ delete this._result;
+ delete this._listener;
+ delete this._pendingSearch;
+
+ if (this._pendingQuery) {
+ this._pendingQuery.cancel();
+ delete this._pendingQuery;
+ }
+ },
+
+ /**
+ * Loads the preferences that we care about.
+ *
+ * @param [optional] aRegisterObserver
+ * Indicates if the preference observer should be added or not. The
+ * default value is false.
+ */
+ _loadPrefs: function UIC_loadPrefs(aRegisterObserver)
+ {
+ let prefBranch = Services.prefs.getBranch(kBrowserUrlbarBranch);
+ let autocomplete = safePrefGetter(prefBranch,
+ kBrowserUrlbarAutocompleteEnabledPref,
+ true);
+ let autofill = safePrefGetter(prefBranch,
+ kBrowserUrlbarAutofillPref,
+ true);
+ this._autofillEnabled = autocomplete && autofill;
+ this._autofillTyped = safePrefGetter(prefBranch,
+ kBrowserUrlbarAutofillTypedPref,
+ true);
+ if (aRegisterObserver) {
+ Services.prefs.addObserver(kBrowserUrlbarBranch, this, true);
+ }
+ },
+
+ //////////////////////////////////////////////////////////////////////////////
+ //// nsIAutoCompleteSearchDescriptor
+
+ get searchType() {
+ return Ci.nsIAutoCompleteSearchDescriptor.SEARCH_TYPE_IMMEDIATE;
+ },
+
+ get clearingAutoFillSearchesAgain() {
+ return false;
+ },
+
+ //////////////////////////////////////////////////////////////////////////////
+ //// nsIObserver
+
+ observe: function UIC_observe(aSubject, aTopic, aData)
+ {
+ if (aTopic == kTopicShutdown) {
+ this._closeDatabase();
+ }
+ else if (aTopic == kPrefChanged &&
+ (aData.substr(kBrowserUrlbarBranch.length) == kBrowserUrlbarAutofillPref ||
+ aData.substr(kBrowserUrlbarBranch.length) == kBrowserUrlbarAutocompleteEnabledPref ||
+ aData.substr(kBrowserUrlbarBranch.length) == kBrowserUrlbarAutofillTypedPref)) {
+ let previousAutofillTyped = this._autofillTyped;
+ this._loadPrefs();
+ if (!this._autofillEnabled) {
+ this.stopSearch();
+ this._closeDatabase();
+ }
+ else if (this._autofillTyped != previousAutofillTyped) {
+ // Invalidate the statements to update them for the new typed status.
+ this._invalidateStatements();
+ }
+ }
+ },
+
+ /**
+ * Finalizes and invalidates cached statements.
+ */
+ _invalidateStatements: function UIC_invalidateStatements()
+ {
+ // Finalize the statements that we have used.
+ let stmts = [
+ "__hostQuery",
+ "__urlQuery",
+ ];
+ for (let i = 0; i < stmts.length; i++) {
+ // We do not want to create any query we haven't already created, so
+ // see if it is a getter first.
+ if (this[stmts[i]]) {
+ this[stmts[i]].finalize();
+ this[stmts[i]] = null;
+ }
+ }
+ },
+
+ /**
+ * Closes the database.
+ */
+ _closeDatabase: function UIC_closeDatabase()
+ {
+ this._invalidateStatements();
+ if (this.__db) {
+ this._db.asyncClose();
+ this.__db = null;
+ }
+ },
+
+ //////////////////////////////////////////////////////////////////////////////
+ //// urlInlineComplete
+
+ _finishSearch: function UIC_finishSearch()
+ {
+ // Notify the result object
+ let result = this._result;
+
+ if (result.matchCount) {
+ result.setDefaultIndex(0);
+ result.setSearchResult(Ci.nsIAutoCompleteResult["RESULT_SUCCESS"]);
+ } else {
+ result.setDefaultIndex(-1);
+ result.setSearchResult(Ci.nsIAutoCompleteResult["RESULT_NOMATCH"]);
+ }
+
+ this._listener.onSearchResult(this, result);
+ this.stopSearch();
+ },
+
+ isSearchComplete: function UIC_isSearchComplete()
+ {
+ return this._pendingQuery == null;
+ },
+
+ isPendingSearch: function UIC_isPendingSearch(aHandle)
+ {
+ return this._pendingQuery == aHandle;
+ },
+
+ //////////////////////////////////////////////////////////////////////////////
+ //// nsISupports
+
+ classID: Components.ID("c88fae2d-25cf-4338-a1f4-64a320ea7440"),
+
+ _xpcom_factory: XPCOMUtils.generateSingletonFactory(urlInlineComplete),
+
+ QueryInterface: XPCOMUtils.generateQI([
+ Ci.nsIAutoCompleteSearch,
+ Ci.nsIAutoCompleteSearchDescriptor,
+ Ci.nsIObserver,
+ Ci.nsISupportsWeakReference,
+ ])
+};
+
+var components = [nsPlacesAutoComplete, urlInlineComplete];
+this.NSGetFactory = XPCOMUtils.generateNSGetFactory(components);
diff --git a/toolkit/components/places/nsPlacesAutoComplete.manifest b/toolkit/components/places/nsPlacesAutoComplete.manifest
new file mode 100644
index 000000000..eb704f449
--- /dev/null
+++ b/toolkit/components/places/nsPlacesAutoComplete.manifest
@@ -0,0 +1,6 @@
+component {d0272978-beab-4adc-a3d4-04b76acfa4e7} nsPlacesAutoComplete.js
+contract @mozilla.org/autocomplete/search;1?name=history {d0272978-beab-4adc-a3d4-04b76acfa4e7}
+
+component {c88fae2d-25cf-4338-a1f4-64a320ea7440} nsPlacesAutoComplete.js
+contract @mozilla.org/autocomplete/search;1?name=urlinline {c88fae2d-25cf-4338-a1f4-64a320ea7440}
+
diff --git a/toolkit/components/places/nsTaggingService.js b/toolkit/components/places/nsTaggingService.js
index 1fad67a82..e367e6cb3 100644
--- a/toolkit/components/places/nsTaggingService.js
+++ b/toolkit/components/places/nsTaggingService.js
@@ -528,6 +528,10 @@ TagAutoCompleteResult.prototype = {
return this._results.length;
},
+ get typeAheadResult() {
+ return false;
+ },
+
/**
* Get the value of the result at the given index
*/
diff --git a/toolkit/components/places/tests/cpp/places_test_harness_tail.h b/toolkit/components/places/tests/cpp/places_test_harness_tail.h
index 4bbd45ccb..9e57c3724 100644
--- a/toolkit/components/places/tests/cpp/places_test_harness_tail.h
+++ b/toolkit/components/places/tests/cpp/places_test_harness_tail.h
@@ -6,9 +6,6 @@
#include "nsWidgetsCID.h"
#include "nsIComponentRegistrar.h"
-#ifdef MOZ_CRASHREPORTER
-#include "nsICrashReporter.h"
-#endif
#ifndef TEST_NAME
#error "Must #define TEST_NAME before including places_test_harness_tail.h"
@@ -94,32 +91,6 @@ main(int aArgc,
return -1;
}
-#ifdef MOZ_CRASHREPORTER
- char* enabled = PR_GetEnv("MOZ_CRASHREPORTER");
- if (enabled && !strcmp(enabled, "1")) {
- // bug 787458: move this to an even-more-common location to use in all
- // C++ unittests
- nsCOMPtr<nsICrashReporter> crashreporter =
- do_GetService("@mozilla.org/toolkit/crash-reporter;1");
- if (crashreporter) {
- fprintf(stderr, "Setting up crash reporting\n");
-
- nsCOMPtr<nsIProperties> dirsvc =
- do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID);
- if (!dirsvc)
- NS_RUNTIMEABORT("Couldn't get directory service");
- nsCOMPtr<nsIFile> cwd;
- nsresult rv = dirsvc->Get(NS_OS_CURRENT_WORKING_DIR,
- NS_GET_IID(nsIFile),
- getter_AddRefs(cwd));
- if (NS_FAILED(rv))
- NS_RUNTIMEABORT("Couldn't get CWD");
- crashreporter->SetEnabled(true);
- crashreporter->SetMinidumpPath(cwd);
- }
- }
-#endif
-
RefPtr<WaitForConnectionClosed> spinClose = new WaitForConnectionClosed();
// Tinderboxes are constantly on idle. Since idle tasks can interact with
diff --git a/toolkit/components/protobuf/moz.build b/toolkit/components/protobuf/moz.build
index b5015eb67..8cca3514c 100644
--- a/toolkit/components/protobuf/moz.build
+++ b/toolkit/components/protobuf/moz.build
@@ -117,10 +117,13 @@ DEFINES['GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER'] = True
# Suppress warnings in third-party code.
if CONFIG['GNU_CXX']:
CXXFLAGS += [
- '-Wno-null-conversion',
'-Wno-return-type',
'-Wno-sign-compare',
]
+ if CONFIG['CLANG_CXX']:
+ CXXFLAGS += [
+ '-Wno-null-conversion',
+ ]
elif CONFIG['_MSC_VER']:
CXXFLAGS += [
'-wd4005', # 'WIN32_LEAN_AND_MEAN' : macro redefinition
diff --git a/toolkit/components/satchel/test/test_form_autocomplete.html b/toolkit/components/satchel/test/test_form_autocomplete.html
index 4cf09117a..d2c22a3db 100644
--- a/toolkit/components/satchel/test/test_form_autocomplete.html
+++ b/toolkit/components/satchel/test/test_form_autocomplete.html
@@ -172,7 +172,7 @@ function setupFormHistory(aCallback) {
{ op : "add", fieldname : "field8", value : "value" },
{ op : "add", fieldname : "field9", value : "value" },
{ op : "add", fieldname : "field10", value : "42" },
- { op : "add", fieldname : "field11", value : "2010-10-10" },
+ { op : "add", fieldname : "field11", value : "2010-10-10" }, // not used, since type=date doesn't have autocomplete currently
{ op : "add", fieldname : "field12", value : "21:21" }, // not used, since type=time doesn't have autocomplete currently
{ op : "add", fieldname : "field13", value : "32" }, // not used, since type=range doesn't have a drop down menu
{ op : "add", fieldname : "field14", value : "#ffffff" }, // not used, since type=color doesn't have autocomplete currently
@@ -899,15 +899,13 @@ function runTest() {
input = $_(14, "field11");
restoreForm();
- expectPopup();
- doKey("down");
+ waitForMenuChange(0);
break;
case 405:
- checkMenuEntries(["2010-10-10"]);
- doKey("down");
- doKey("return");
- checkForm("2010-10-10");
+ checkMenuEntries([]); // type=date with it's own control frame does not
+ // have a drop down menu for now
+ checkForm("");
input = $_(15, "field12");
restoreForm();
diff --git a/toolkit/components/telemetry/TelemetryEnvironment.jsm b/toolkit/components/telemetry/TelemetryEnvironment.jsm
index 2f4ac81ba..910d804ae 100644
--- a/toolkit/components/telemetry/TelemetryEnvironment.jsm
+++ b/toolkit/components/telemetry/TelemetryEnvironment.jsm
@@ -153,7 +153,6 @@ const DEFAULT_ENVIRONMENT_PREFS = new Map([
["dom.ipc.plugins.enabled", {what: RECORD_PREF_VALUE}],
["dom.ipc.processCount", {what: RECORD_PREF_VALUE, requiresRestart: true}],
["dom.max_script_run_time", {what: RECORD_PREF_VALUE}],
- ["experiments.manifest.uri", {what: RECORD_PREF_VALUE}],
["extensions.autoDisableScopes", {what: RECORD_PREF_VALUE}],
["extensions.enabledScopes", {what: RECORD_PREF_VALUE}],
["extensions.blocklist.enabled", {what: RECORD_PREF_VALUE}],
@@ -209,7 +208,6 @@ const PREF_E10S_COHORT = "e10s.rollout.cohort";
const COMPOSITOR_CREATED_TOPIC = "compositor:created";
const DISTRIBUTION_CUSTOMIZATION_COMPLETE_TOPIC = "distribution-customization-complete";
-const EXPERIMENTS_CHANGED_TOPIC = "experiments-changed";
const GFX_FEATURES_READY_TOPIC = "gfx-features-ready";
const SEARCH_ENGINE_MODIFIED_TOPIC = "browser-search-engine-modified";
const SEARCH_SERVICE_TOPIC = "browser-search-service";
@@ -465,7 +463,6 @@ EnvironmentAddonBuilder.prototype = {
watchForChanges: function() {
this._loaded = true;
AddonManager.addAddonListener(this);
- Services.obs.addObserver(this, EXPERIMENTS_CHANGED_TOPIC, false);
},
// AddonListener
@@ -490,7 +487,6 @@ EnvironmentAddonBuilder.prototype = {
// nsIObserver
observe: function (aSubject, aTopic, aData) {
this._environment._log.trace("observe - Topic " + aTopic);
- this._checkForChanges("experiment-changed");
},
_checkForChanges: function(changeReason) {
@@ -515,7 +511,6 @@ EnvironmentAddonBuilder.prototype = {
_shutdownBlocker: function() {
if (this._loaded) {
AddonManager.removeAddonListener(this);
- Services.obs.removeObserver(this, EXPERIMENTS_CHANGED_TOPIC);
}
return this._pendingTask;
},
@@ -545,7 +540,6 @@ EnvironmentAddonBuilder.prototype = {
theme: yield this._getActiveTheme(),
activePlugins: this._getActivePlugins(),
activeGMPlugins: yield this._getActiveGMPlugins(),
- activeExperiment: this._getActiveExperiment(),
persona: personaId,
};
@@ -718,29 +712,7 @@ EnvironmentAddonBuilder.prototype = {
}
return activeGMPlugins;
- }),
-
- /**
- * Get the active experiment data in object form.
- * @return Object containing the active experiment data.
- */
- _getActiveExperiment: function () {
- let experimentInfo = {};
- try {
- let scope = {};
- Cu.import("resource:///modules/experiments/Experiments.jsm", scope);
- let experiments = scope.Experiments.instance();
- let activeExperiment = experiments.getActiveExperimentID();
- if (activeExperiment) {
- experimentInfo.id = activeExperiment;
- experimentInfo.branch = experiments.getActiveExperimentBranch();
- }
- } catch (e) {
- // If this is not Firefox, the import will fail.
- }
-
- return experimentInfo;
- },
+ })
};
function EnvironmentCache() {
diff --git a/toolkit/components/terminator/nsTerminator.cpp b/toolkit/components/terminator/nsTerminator.cpp
index f9459cc5d..91e872821 100644
--- a/toolkit/components/terminator/nsTerminator.cpp
+++ b/toolkit/components/terminator/nsTerminator.cpp
@@ -29,9 +29,6 @@
#include "nsIObserverService.h"
#include "nsIPrefService.h"
-#if defined(MOZ_CRASHREPORTER)
-#include "nsExceptionHandler.h"
-#endif
#if defined(XP_WIN)
#include <windows.h>
@@ -541,13 +538,7 @@ nsTerminator::UpdateTelemetry()
void
nsTerminator::UpdateCrashReport(const char* aTopic)
{
-#if defined(MOZ_CRASHREPORTER)
- // In case of crash, we wish to know where in shutdown we are
- nsAutoCString report(aTopic);
-
- Unused << CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("ShutdownProgress"),
- report);
-#endif // defined(MOZ_CRASH_REPORTER)
+ /*** STUB ***/
}
diff --git a/toolkit/components/url-classifier/HashStore.cpp b/toolkit/components/url-classifier/HashStore.cpp
index c298612aa..77bf3cbd4 100644
--- a/toolkit/components/url-classifier/HashStore.cpp
+++ b/toolkit/components/url-classifier/HashStore.cpp
@@ -964,8 +964,7 @@ HashStore::WriteFile()
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIOutputStream> out;
- rv = NS_NewCheckSummedOutputStream(getter_AddRefs(out), storeFile,
- PR_WRONLY | PR_TRUNCATE | PR_CREATE_FILE);
+ rv = NS_NewCheckSummedOutputStream(getter_AddRefs(out), storeFile);
NS_ENSURE_SUCCESS(rv, rv);
uint32_t written;
diff --git a/toolkit/components/url-classifier/nsCheckSummedOutputStream.cpp b/toolkit/components/url-classifier/nsCheckSummedOutputStream.cpp
index 68f9f1f6f..0e89fd20c 100644
--- a/toolkit/components/url-classifier/nsCheckSummedOutputStream.cpp
+++ b/toolkit/components/url-classifier/nsCheckSummedOutputStream.cpp
@@ -13,14 +13,11 @@
// nsCheckSummedOutputStream
NS_IMPL_ISUPPORTS_INHERITED(nsCheckSummedOutputStream,
- nsSafeFileOutputStream,
- nsISafeOutputStream,
- nsIOutputStream,
- nsIFileOutputStream)
+ nsBufferedOutputStream,
+ nsISafeOutputStream)
NS_IMETHODIMP
-nsCheckSummedOutputStream::Init(nsIFile* file, int32_t ioFlags, int32_t perm,
- int32_t behaviorFlags)
+nsCheckSummedOutputStream::Init(nsIOutputStream* stream, uint32_t bufferSize)
{
nsresult rv;
mHash = do_CreateInstance(NS_CRYPTO_HASH_CONTRACTID, &rv);
@@ -29,7 +26,7 @@ nsCheckSummedOutputStream::Init(nsIFile* file, int32_t ioFlags, int32_t perm,
rv = mHash->Init(nsICryptoHash::MD5);
NS_ENSURE_SUCCESS(rv, rv);
- return nsSafeFileOutputStream::Init(file, ioFlags, perm, behaviorFlags);
+ return nsBufferedOutputStream::Init(stream, bufferSize);
}
NS_IMETHODIMP
@@ -39,12 +36,12 @@ nsCheckSummedOutputStream::Finish()
NS_ENSURE_SUCCESS(rv, rv);
uint32_t written;
- rv = nsSafeFileOutputStream::Write(reinterpret_cast<const char*>(mCheckSum.BeginReading()),
+ rv = nsBufferedOutputStream::Write(reinterpret_cast<const char*>(mCheckSum.BeginReading()),
mCheckSum.Length(), &written);
NS_ASSERTION(written == mCheckSum.Length(), "Error writing stream checksum");
NS_ENSURE_SUCCESS(rv, rv);
- return nsSafeFileOutputStream::Finish();
+ return nsBufferedOutputStream::Finish();
}
NS_IMETHODIMP
@@ -53,7 +50,7 @@ nsCheckSummedOutputStream::Write(const char *buf, uint32_t count, uint32_t *resu
nsresult rv = mHash->Update(reinterpret_cast<const uint8_t*>(buf), count);
NS_ENSURE_SUCCESS(rv, rv);
- return nsSafeFileOutputStream::Write(buf, count, result);
+ return nsBufferedOutputStream::Write(buf, count, result);
}
////////////////////////////////////////////////////////////////////////////////
diff --git a/toolkit/components/url-classifier/nsCheckSummedOutputStream.h b/toolkit/components/url-classifier/nsCheckSummedOutputStream.h
index c2fe26b5f..b72c7da86 100644
--- a/toolkit/components/url-classifier/nsCheckSummedOutputStream.h
+++ b/toolkit/components/url-classifier/nsCheckSummedOutputStream.h
@@ -12,25 +12,27 @@
#include "nsICryptoHash.h"
#include "nsNetCID.h"
#include "nsString.h"
-#include "../../../netwerk/base/nsFileStreams.h"
#include "nsToolkitCompsCID.h"
+#include "../../../netwerk/base/nsBufferedStreams.h"
+#include "prio.h"
-class nsCheckSummedOutputStream : public nsSafeFileOutputStream
+class nsCheckSummedOutputStream : public nsBufferedOutputStream
{
public:
NS_DECL_ISUPPORTS_INHERITED
// Size of MD5 hash in bytes
static const uint32_t CHECKSUM_SIZE = 16;
+ static const uint32_t MAX_BUFFER_SIZE = 64 * 1024;
nsCheckSummedOutputStream() {}
NS_IMETHOD Finish() override;
NS_IMETHOD Write(const char *buf, uint32_t count, uint32_t *result) override;
- NS_IMETHOD Init(nsIFile* file, int32_t ioFlags, int32_t perm, int32_t behaviorFlags) override;
+ NS_IMETHOD Init(nsIOutputStream* stream, uint32_t bufferSize) override;
protected:
- virtual ~nsCheckSummedOutputStream() { nsSafeFileOutputStream::Close(); }
+ virtual ~nsCheckSummedOutputStream() { nsBufferedOutputStream::Close(); }
nsCOMPtr<nsICryptoHash> mHash;
nsCString mCheckSum;
@@ -39,13 +41,15 @@ protected:
// returns a file output stream which can be QI'ed to nsIFileOutputStream.
inline nsresult
NS_NewCheckSummedOutputStream(nsIOutputStream **result,
- nsIFile *file,
- int32_t ioFlags = -1,
- int32_t perm = -1,
- int32_t behaviorFlags = 0)
+ nsIFile *file)
{
- nsCOMPtr<nsIFileOutputStream> out = new nsCheckSummedOutputStream();
- nsresult rv = out->Init(file, ioFlags, perm, behaviorFlags);
+ nsCOMPtr<nsIOutputStream> localOutFile;
+ nsresult rv = NS_NewSafeLocalFileOutputStream(getter_AddRefs(localOutFile), file,
+ PR_WRONLY | PR_TRUNCATE | PR_CREATE_FILE);
+ NS_ENSURE_SUCCESS(rv, rv);
+
+ nsCOMPtr<nsIBufferedOutputStream> out = new nsCheckSummedOutputStream();
+ rv = out->Init(localOutFile, nsCheckSummedOutputStream::CHECKSUM_SIZE);
if (NS_SUCCEEDED(rv)) {
out.forget(result);
}
diff --git a/toolkit/components/webextensions/ExtensionChild.jsm b/toolkit/components/webextensions/ExtensionChild.jsm
index c953dd685..5dc4e2277 100644
--- a/toolkit/components/webextensions/ExtensionChild.jsm
+++ b/toolkit/components/webextensions/ExtensionChild.jsm
@@ -325,7 +325,7 @@ class Messenger {
return this.sendMessage(messageManager, msg, recipient, responseCallback);
}
- onMessage(name) {
+ _onMessage(name, filter) {
return new SingletonEventManager(this.context, name, callback => {
let listener = {
messageFilterPermissive: this.optionalFilter,
@@ -333,7 +333,8 @@ class Messenger {
filterMessage: (sender, recipient) => {
// Ignore the message if it was sent by this Messenger.
- return sender.contextId !== this.context.contextId;
+ return (sender.contextId !== this.context.contextId &&
+ filter(sender, recipient));
},
receiveMessage: ({target, data: message, sender, recipient}) => {
@@ -373,6 +374,14 @@ class Messenger {
}).api();
}
+ onMessage(name) {
+ return this._onMessage(name, sender => sender.id === this.sender.id);
+ }
+
+ onMessageExternal(name) {
+ return this._onMessage(name, sender => sender.id !== this.sender.id);
+ }
+
_connect(messageManager, port, recipient) {
let msg = {
name: port.name,
@@ -407,7 +416,7 @@ class Messenger {
return this._connect(messageManager, port, recipient);
}
- onConnect(name) {
+ _onConnect(name, filter) {
return new SingletonEventManager(this.context, name, callback => {
let listener = {
messageFilterPermissive: this.optionalFilter,
@@ -415,7 +424,8 @@ class Messenger {
filterMessage: (sender, recipient) => {
// Ignore the port if it was created by this Messenger.
- return sender.contextId !== this.context.contextId;
+ return (sender.contextId !== this.context.contextId &&
+ filter(sender, recipient));
},
receiveMessage: ({target, data: message, sender}) => {
@@ -438,6 +448,14 @@ class Messenger {
};
}).api();
}
+
+ onConnect(name) {
+ return this._onConnect(name, sender => sender.id === this.sender.id);
+ }
+
+ onConnectExternal(name) {
+ return this._onConnect(name, sender => sender.id !== this.sender.id);
+ }
}
var apiManager = new class extends SchemaAPIManager {
@@ -745,7 +763,7 @@ class ExtensionPageContextChild extends BaseContext {
// This is the MessageSender property passed to extension.
// It can be augmented by the "page-open" hook.
- let sender = {id: extension.uuid};
+ let sender = {id: extension.id};
if (viewType == "tab") {
sender.tabId = tabId;
this.tabId = tabId;
diff --git a/toolkit/components/webextensions/ExtensionCommon.jsm b/toolkit/components/webextensions/ExtensionCommon.jsm
index a339fb27e..9ec84b5c7 100644
--- a/toolkit/components/webextensions/ExtensionCommon.jsm
+++ b/toolkit/components/webextensions/ExtensionCommon.jsm
@@ -197,10 +197,9 @@ class BaseContext {
* @returns {Promise}
*/
sendMessage(target, messageName, data, options = {}) {
- options.recipient = options.recipient || {};
+ options.recipient = Object.assign({extensionId: this.extension.id}, options.recipient);
options.sender = options.sender || {};
- options.recipient.extensionId = this.extension.id;
options.sender.extensionId = this.extension.id;
options.sender.contextId = this.contextId;
diff --git a/toolkit/components/webextensions/ExtensionContent.jsm b/toolkit/components/webextensions/ExtensionContent.jsm
index 9b9a02091..5f9b88f35 100644
--- a/toolkit/components/webextensions/ExtensionContent.jsm
+++ b/toolkit/components/webextensions/ExtensionContent.jsm
@@ -344,6 +344,7 @@ class ContentScriptContextChild extends BaseContext {
// because it enables us to create the APIs object in this sandbox object and then copying it
// into the iframe's window, see Bug 1214658 for rationale)
this.sandbox = Cu.Sandbox(contentWindow, {
+ sandboxName: `Web-Accessible Extension Page ${this.extension.id}`,
sandboxPrototype: contentWindow,
sameZoneAs: contentWindow,
wantXrays: false,
@@ -360,6 +361,7 @@ class ContentScriptContextChild extends BaseContext {
this.sandbox = Cu.Sandbox(principal, {
metadata,
+ sandboxName: `Content Script ${this.extension.id}`,
sandboxPrototype: contentWindow,
sameZoneAs: contentWindow,
wantXrays: true,
@@ -456,7 +458,7 @@ class ContentScriptContextChild extends BaseContext {
defineLazyGetter(ContentScriptContextChild.prototype, "messenger", function() {
// The |sender| parameter is passed directly to the extension.
- let sender = {id: this.extension.uuid, frameId: this.frameId, url: this.url};
+ let sender = {id: this.extension.id, frameId: this.frameId, url: this.url};
let filter = {extensionId: this.extension.id};
let optionalFilter = {frameId: this.frameId};
diff --git a/toolkit/components/webextensions/LegacyExtensionsUtils.jsm b/toolkit/components/webextensions/LegacyExtensionsUtils.jsm
index 7632548e3..e8d276fe9 100644
--- a/toolkit/components/webextensions/LegacyExtensionsUtils.jsm
+++ b/toolkit/components/webextensions/LegacyExtensionsUtils.jsm
@@ -64,7 +64,7 @@ var LegacyExtensionContext = class extends BaseContext {
{value: cloneScope, enumerable: true, configurable: true, writable: true}
);
- let sender = {id: targetExtension.uuid};
+ let sender = {id: targetExtension.id};
let filter = {extensionId: targetExtension.id};
// Legacy addons live in the main process. Messages from other addons are
// Messages from WebExtensions are sent to the main process and forwarded via
diff --git a/toolkit/components/webextensions/ext-c-runtime.js b/toolkit/components/webextensions/ext-c-runtime.js
index 8adca60ca..1dcac35da 100644
--- a/toolkit/components/webextensions/ext-c-runtime.js
+++ b/toolkit/components/webextensions/ext-c-runtime.js
@@ -9,6 +9,10 @@ function runtimeApiFactory(context) {
onMessage: context.messenger.onMessage("runtime.onMessage"),
+ onConnectExternal: context.messenger.onConnectExternal("runtime.onConnectExternal"),
+
+ onMessageExternal: context.messenger.onMessageExternal("runtime.onMessageExternal"),
+
connect: function(extensionId, connectInfo) {
let name = connectInfo !== null && connectInfo.name || "";
extensionId = extensionId || extension.id;
@@ -47,7 +51,6 @@ function runtimeApiFactory(context) {
if (options != null && typeof options != "object") {
return Promise.reject({message: "runtime.sendMessage's options argument is invalid"});
}
- // TODO(robwu): Validate option keys and values when we support it.
extensionId = extensionId || extension.id;
let recipient = {extensionId};
diff --git a/toolkit/components/webextensions/schemas/runtime.json b/toolkit/components/webextensions/schemas/runtime.json
index b3f12a768..575df7d27 100644
--- a/toolkit/components/webextensions/schemas/runtime.json
+++ b/toolkit/components/webextensions/schemas/runtime.json
@@ -535,7 +535,6 @@
},
{
"name": "onConnectExternal",
- "unsupported": true,
"type": "function",
"description": "Fired when a connection is made from another extension.",
"parameters": [
@@ -560,7 +559,6 @@
},
{
"name": "onMessageExternal",
- "unsupported": true,
"type": "function",
"description": "Fired when a message is sent from another extension/app. Cannot be used in a content script.",
"parameters": [
diff --git a/toolkit/components/webextensions/test/mochitest/mochitest.ini b/toolkit/components/webextensions/test/mochitest/mochitest.ini
index 45586237e..1f61060ad 100644
--- a/toolkit/components/webextensions/test/mochitest/mochitest.ini
+++ b/toolkit/components/webextensions/test/mochitest/mochitest.ini
@@ -59,6 +59,7 @@ skip-if = os == 'android' # Android does not support tabs API. Bug 1260250
[test_ext_contentscript_teardown.html]
skip-if = (os == 'android') # Android does not support tabs API. Bug 1260250
[test_ext_exclude_include_globs.html]
+[test_ext_external_messaging.html]
[test_ext_i18n_css.html]
[test_ext_generate.html]
[test_ext_notifications.html]
diff --git a/toolkit/components/webextensions/test/mochitest/test_ext_all_apis.js b/toolkit/components/webextensions/test/mochitest/test_ext_all_apis.js
index 0f617c37e..25d04b36b 100644
--- a/toolkit/components/webextensions/test/mochitest/test_ext_all_apis.js
+++ b/toolkit/components/webextensions/test/mochitest/test_ext_all_apis.js
@@ -75,7 +75,9 @@ let expectedBackgroundApis = [
"runtime.getBackgroundPage",
"runtime.getBrowserInfo",
"runtime.getPlatformInfo",
+ "runtime.onConnectExternal",
"runtime.onInstalled",
+ "runtime.onMessageExternal",
"runtime.onStartup",
"runtime.onUpdateAvailable",
"runtime.openOptionsPage",
diff --git a/toolkit/components/webextensions/test/mochitest/test_ext_external_messaging.html b/toolkit/components/webextensions/test/mochitest/test_ext_external_messaging.html
new file mode 100644
index 000000000..dfc1f9427
--- /dev/null
+++ b/toolkit/components/webextensions/test/mochitest/test_ext_external_messaging.html
@@ -0,0 +1,111 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>WebExtension external messaging</title>
+ <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="text/javascript" src="/tests/SimpleTest/SpawnTask.js"></script>
+ <script type="text/javascript" src="/tests/SimpleTest/ExtensionTestUtils.js"></script>
+ <script type="text/javascript" src="head.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+
+<script type="text/javascript">
+"use strict";
+
+function backgroundScript(id, otherId) {
+ browser.runtime.onMessage.addListener((msg, sender) => {
+ browser.test.fail(`Got unexpected message: ${uneval(msg)} ${uneval(sender)}`);
+ });
+
+ browser.runtime.onConnect.addListener(port => {
+ browser.test.fail(`Got unexpected connection: ${uneval(port.sender)}`);
+ });
+
+ browser.runtime.onMessageExternal.addListener((msg, sender) => {
+ browser.test.assertEq(otherId, sender.id, `${id}: Got expected external sender ID`);
+ browser.test.assertEq(`helo-${id}`, msg, "Got expected message");
+
+ browser.test.sendMessage("onMessage-done");
+
+ return Promise.resolve(`ehlo-${otherId}`);
+ });
+
+ browser.runtime.onConnectExternal.addListener(port => {
+ browser.test.assertEq(otherId, port.sender.id, `${id}: Got expected external connecter ID`);
+
+ port.onMessage.addListener(msg => {
+ browser.test.assertEq(`helo-${id}`, msg, "Got expected port message");
+
+ port.postMessage(`ehlo-${otherId}`);
+
+ browser.test.sendMessage("onConnect-done");
+ });
+ });
+
+ browser.test.onMessage.addListener(msg => {
+ if (msg === "go") {
+ browser.runtime.sendMessage(otherId, `helo-${otherId}`).then(result => {
+ browser.test.assertEq(`ehlo-${id}`, result, "Got expected reply");
+ browser.test.sendMessage("sendMessage-done");
+ });
+
+ let port = browser.runtime.connect(otherId);
+ port.postMessage(`helo-${otherId}`);
+
+ port.onMessage.addListener(msg => {
+ port.disconnect();
+
+ browser.test.assertEq(msg, `ehlo-${id}`, "Got expected port reply");
+ browser.test.sendMessage("connect-done");
+ });
+ }
+ });
+}
+
+function makeExtension(id, otherId) {
+ let args = `${JSON.stringify(id)}, ${JSON.stringify(otherId)}`;
+
+ let extensionData = {
+ background: `(${backgroundScript})(${args})`,
+ manifest: {
+ "applications": {"gecko": {id}},
+ },
+ };
+
+ return ExtensionTestUtils.loadExtension(extensionData);
+}
+
+add_task(function* test_contentscript() {
+ const ID1 = "foo-message@mochitest.mozilla.org";
+ const ID2 = "bar-message@mochitest.mozilla.org";
+
+ let extension1 = makeExtension(ID1, ID2);
+ let extension2 = makeExtension(ID2, ID1);
+
+ yield Promise.all([extension1.startup(), extension2.startup()]);
+
+ extension1.sendMessage("go");
+ extension2.sendMessage("go");
+
+ yield Promise.all([
+ extension1.awaitMessage("sendMessage-done"),
+ extension2.awaitMessage("sendMessage-done"),
+
+ extension1.awaitMessage("onMessage-done"),
+ extension2.awaitMessage("onMessage-done"),
+
+ extension1.awaitMessage("connect-done"),
+ extension2.awaitMessage("connect-done"),
+
+ extension1.awaitMessage("onConnect-done"),
+ extension2.awaitMessage("onConnect-done"),
+ ]);
+
+ yield extension1.unload();
+ yield extension2.unload();
+});
+</script>
+
+</body>
+</html>
diff --git a/toolkit/components/webextensions/test/mochitest/test_ext_sendmessage_reply2.html b/toolkit/components/webextensions/test/mochitest/test_ext_sendmessage_reply2.html
index 1ebc1b40f..5c350be2f 100644
--- a/toolkit/components/webextensions/test/mochitest/test_ext_sendmessage_reply2.html
+++ b/toolkit/components/webextensions/test/mochitest/test_ext_sendmessage_reply2.html
@@ -13,48 +13,119 @@
<script type="text/javascript">
"use strict";
-function backgroundScript(token) {
+function backgroundScript(token, id, otherId) {
+ browser.tabs.create({url: "tab.html"});
+
browser.runtime.onMessage.addListener((msg, sender, sendReply) => {
- browser.test.assertTrue(sender.tab.url.endsWith("file_sample.html"), "sender url correct");
+ browser.test.assertEq(id, sender.id, `${id}: Got expected sender ID`);
- if (msg == "done") {
- browser.test.notifyPass("sendmessage_reply");
- return;
+ if (msg === `content-${token}`) {
+ browser.test.assertTrue(sender.tab.url.endsWith("file_sample.html"),
+ `${id}: sender url correct`);
+
+ let tabId = sender.tab.id;
+ browser.tabs.sendMessage(tabId, `${token}-contentMessage`);
+
+ sendReply(`${token}-done`);
+ } else if (msg === `tab-${token}`) {
+ browser.runtime.sendMessage(otherId, `${otherId}-tabMessage`);
+ browser.runtime.sendMessage(`${token}-tabMessage`);
+
+ sendReply(`${token}-done`);
+ } else {
+ browser.test.fail(`${id}: Unexpected runtime message received: ${msg} ${uneval(sender)}`);
}
+ });
+
+ browser.runtime.onMessageExternal.addListener((msg, sender, sendReply) => {
+ browser.test.assertEq(otherId, sender.id, `${id}: Got expected external sender ID`);
+
+ if (msg === `content-${id}`) {
+ browser.test.assertTrue(sender.tab.url.endsWith("file_sample.html"),
+ `${id}: external sender url correct`);
+
+ sendReply(`${otherId}-done`);
+ } else if (msg === `tab-${id}`) {
+ sendReply(`${otherId}-done`);
+ } else if (msg !== `${id}-tabMessage`) {
+ browser.test.fail(`${id}: Unexpected runtime external message received: ${msg} ${uneval(sender)}`);
+ }
+ });
+}
+
+function contentScript(token, id, otherId) {
+ let gotContentMessage = false;
+ browser.runtime.onMessage.addListener((msg, sender, sendReply) => {
+ browser.test.assertEq(id, sender.id, `${id}: Got expected sender ID`);
+
+ browser.test.assertEq(`${token}-contentMessage`, msg,
+ `${id}: Correct content script message`);
+ if (msg === `${token}-contentMessage`) {
+ gotContentMessage = true;
+ }
+ });
+
+ Promise.all([
+ browser.runtime.sendMessage(otherId, `content-${otherId}`).then(resp => {
+ browser.test.assertEq(`${id}-done`, resp, `${id}: Correct content script external response token`);
+ }),
- let tabId = sender.tab.id;
- browser.tabs.sendMessage(tabId, `${token}-tabMessage`);
+ browser.runtime.sendMessage(`content-${token}`).then(resp => {
+ browser.test.assertEq(`${token}-done`, resp, `${id}: Correct content script response token`);
+ }),
+ ]).then(() => {
+ browser.test.assertTrue(gotContentMessage, `${id}: Got content script message`);
- browser.test.assertEq(msg, token, "token matches");
- sendReply(`${token}-done`);
+ browser.test.sendMessage("content-script-done");
});
}
-function contentScript(token) {
+function tabScript(token, id, otherId) {
let gotTabMessage = false;
- let badTabMessage = false;
browser.runtime.onMessage.addListener((msg, sender, sendReply) => {
- if (msg == `${token}-tabMessage`) {
+ browser.test.assertEq(id, sender.id, `${id}: Got expected sender ID`);
+
+ if (String(msg).startsWith("content-")) {
+ return;
+ }
+
+ browser.test.assertEq(`${token}-tabMessage`, msg,
+ `${id}: Correct tab script message`);
+ if (msg === `${token}-tabMessage`) {
gotTabMessage = true;
- } else {
- badTabMessage = true;
}
});
- browser.runtime.sendMessage(token, function(resp) {
- if (resp != `${token}-done` || !gotTabMessage || badTabMessage) {
- return; // test failed
- }
- browser.runtime.sendMessage("done");
+ Promise.all([
+ browser.runtime.sendMessage(otherId, `tab-${otherId}`).then(resp => {
+ browser.test.assertEq(`${id}-done`, resp, `${id}: Correct tab script external response token`);
+ }),
+
+ browser.runtime.sendMessage(`tab-${token}`).then(resp => {
+ browser.test.assertEq(`${token}-done`, resp, `${id}: Correct tab script response token`);
+ }),
+ ]).then(() => {
+ browser.test.assertTrue(gotTabMessage, `${id}: Got tab script message`);
+
+ window.close();
+
+ browser.test.sendMessage("tab-script-done");
});
}
-function makeExtension() {
+function makeExtension(id, otherId) {
let token = Math.random();
+
+ let args = `${token}, ${JSON.stringify(id)}, ${JSON.stringify(otherId)}`;
+
let extensionData = {
- background: `(${backgroundScript})(${token})`,
+ background: `(${backgroundScript})(${args})`,
manifest: {
+ "applications": {"gecko": {id}},
+
"permissions": ["tabs"],
+
+
"content_scripts": [{
"matches": ["http://mochi.test/*/file_sample.html"],
"js": ["content_script.js"],
@@ -63,29 +134,46 @@ function makeExtension() {
},
files: {
- "content_script.js": `(${contentScript})(${token})`,
+ "tab.html": `<!DOCTYPE html>
+ <html>
+ <head>
+ <meta charset="utf-8">
+ <script src="tab.js"><\/script>
+ </head>
+ </html>`,
+
+ "tab.js": `(${tabScript})(${args})`,
+
+ "content_script.js": `(${contentScript})(${args})`,
},
};
return extensionData;
}
add_task(function* test_contentscript() {
- let extension1 = ExtensionTestUtils.loadExtension(makeExtension());
- let extension2 = ExtensionTestUtils.loadExtension(makeExtension());
+ const ID1 = "sendmessage1@mochitest.mozilla.org";
+ const ID2 = "sendmessage2@mochitest.mozilla.org";
+
+ let extension1 = ExtensionTestUtils.loadExtension(makeExtension(ID1, ID2));
+ let extension2 = ExtensionTestUtils.loadExtension(makeExtension(ID2, ID1));
yield Promise.all([extension1.startup(), extension2.startup()]);
let win = window.open("file_sample.html");
- yield Promise.all([waitForLoad(win),
- extension1.awaitFinish("sendmessage_reply"),
- extension2.awaitFinish("sendmessage_reply")]);
+ yield waitForLoad(win);
+
+ yield Promise.all([
+ extension1.awaitMessage("content-script-done"),
+ extension2.awaitMessage("content-script-done"),
+ extension1.awaitMessage("tab-script-done"),
+ extension2.awaitMessage("tab-script-done"),
+ ]);
win.close();
yield extension1.unload();
yield extension2.unload();
- info("extensions unloaded");
});
</script>
diff --git a/toolkit/components/webextensions/test/xpcshell/test_ext_legacy_extension_context.js b/toolkit/components/webextensions/test/xpcshell/test_ext_legacy_extension_context.js
index 63d5361a1..770851472 100644
--- a/toolkit/components/webextensions/test/xpcshell/test_ext_legacy_extension_context.js
+++ b/toolkit/components/webextensions/test/xpcshell/test_ext_legacy_extension_context.js
@@ -108,7 +108,7 @@ add_task(function* test_legacy_extension_context() {
"Got the expected message");
ok(msgSender, "Got a message sender object");
- equal(msgSender.id, extensionInfo.uuid, "The sender has the expected id property");
+ equal(msgSender.id, extension.id, "The sender has the expected id property");
equal(msgSender.url, extensionInfo.bgURL, "The sender has the expected url property");
// Wait confirmation that the reply has been received.
@@ -136,7 +136,7 @@ add_task(function* test_legacy_extension_context() {
ok(port, "Got the Port API object");
ok(port.sender, "The port has a sender property");
- equal(port.sender.id, extensionInfo.uuid,
+ equal(port.sender.id, extension.id,
"The port sender has the expected id property");
equal(port.sender.url, extensionInfo.bgURL,
"The port sender has the expected url property");
diff --git a/toolkit/components/xulstore/XULStore.js b/toolkit/components/xulstore/XULStore.js
index c2721327c..8b5bc1313 100644
--- a/toolkit/components/xulstore/XULStore.js
+++ b/toolkit/components/xulstore/XULStore.js
@@ -63,11 +63,21 @@ XULStore.prototype = {
load: function () {
Services.obs.addObserver(this, "profile-before-change", true);
- this._storeFile = Services.dirsvc.get("ProfD", Ci.nsIFile);
+ let profileType = "ProfD";
+ try {
+ this._storeFile = Services.dirsvc.get(profileType, Ci.nsIFile);
+ } catch (ex) {
+ try {
+ profileType = "ProfDS";
+ this._storeFile = Services.dirsvc.get(profileType, Ci.nsIFile);
+ } catch (ex) {
+ throw new Error("Can't find profile directory.");
+ }
+ }
this._storeFile.append(STOREDB_FILENAME);
if (!this._storeFile.exists()) {
- this.import();
+ this.import(profileType);
} else {
this.readFile();
}
@@ -90,8 +100,8 @@ XULStore.prototype = {
Services.console.logStringMessage("XULStore: " + message);
},
- import: function() {
- let localStoreFile = Services.dirsvc.get("ProfD", Ci.nsIFile);
+ import(profileType) {
+ let localStoreFile = Services.dirsvc.get(profileType || "ProfD", Ci.nsIFile);
localStoreFile.append("localstore.rdf");
if (!localStoreFile.exists()) {
diff --git a/toolkit/content/about.js b/toolkit/content/about.js
index ae467d07a..c27916c10 100644
--- a/toolkit/content/about.js
+++ b/toolkit/content/about.js
@@ -5,14 +5,24 @@
// get release notes and vendor URL from prefs
var formatter = Components.classes["@mozilla.org/toolkit/URLFormatterService;1"]
.getService(Components.interfaces.nsIURLFormatter);
-var releaseNotesURL = formatter.formatURLPref("app.releaseNotesURL");
+var releaseNotesURL;
+try {
+ releaseNotesURL = formatter.formatURLPref("app.releaseNotesURL");
+} catch(e) {
+ releaseNotesURL = "about:blank";
+}
if (releaseNotesURL != "about:blank") {
var relnotes = document.getElementById("releaseNotesURL");
relnotes.setAttribute("href", releaseNotesURL);
relnotes.parentNode.removeAttribute("hidden");
}
-var vendorURL = formatter.formatURLPref("app.vendorURL");
+var vendorURL;
+try {
+ vendorURL = formatter.formatURLPref("app.vendorURL");
+} catch(e) {
+ vendorURL = "about:blank";
+}
if (vendorURL != "about:blank") {
var vendor = document.getElementById("vendorURL");
vendor.setAttribute("href", vendorURL);
@@ -25,8 +35,15 @@ var versionNum = Components.classes["@mozilla.org/xre/app-info;1"]
var version = document.getElementById("version");
version.textContent += " " + versionNum;
+// insert the buildid of the XUL application
+var BuildIDVal = Components.classes["@mozilla.org/xre/app-info;1"]
+ .getService(Components.interfaces.nsIXULAppInfo)
+ .appBuildID;
+var buildID = document.getElementById("buildID");
+buildID.textContent += " " + BuildIDVal.slice(0,-6);
+
// append user agent
var ua = navigator.userAgent;
if (ua) {
- document.getElementById("buildID").textContent += " " + ua;
+ document.getElementById("userAgent").textContent += " " + ua;
}
diff --git a/toolkit/content/about.xhtml b/toolkit/content/about.xhtml
index d5245928f..1f57ddcc3 100644
--- a/toolkit/content/about.xhtml
+++ b/toolkit/content/about.xhtml
@@ -24,7 +24,6 @@
<div id="aboutLogoContainer">
<a id="vendorURL">
<img src="about:logo" alt="&brandShortName;"/>
- <p id="version">&about.version;</p>
</a>
</div>
@@ -33,7 +32,9 @@
<li>&about.license.beforeTheLink;<a href="about:license">&about.license.linkTitle;</a>&about.license.afterTheLink;</li>
<li hidden="true">&about.relnotes.beforeTheLink;<a id="releaseNotesURL">&about.relnotes.linkTitle;</a>&about.relnotes.afterTheLink;</li>
<li>&about.buildconfig.beforeTheLink;<a href="about:buildconfig">&about.buildconfig.linkTitle;</a>&about.buildconfig.afterTheLink;</li>
+ <li id="version">&about.version;</li>
<li id="buildID">&about.buildIdentifier;</li>
+ <li id="userAgent">&about.userAgent;</li>
<script type="application/javascript" src="chrome://global/content/about.js"/>
</ul>
diff --git a/toolkit/content/aboutSupport.js b/toolkit/content/aboutSupport.js
index 5daf6d189..e9087dfcb 100644
--- a/toolkit/content/aboutSupport.js
+++ b/toolkit/content/aboutSupport.js
@@ -75,69 +75,7 @@ var snapshotFormatters = {
},
crashes: function crashes(data) {
- if (!AppConstants.MOZ_CRASHREPORTER)
- return;
-
- let strings = stringBundle();
- let daysRange = Troubleshoot.kMaxCrashAge / (24 * 60 * 60 * 1000);
- $("crashes-title").textContent =
- PluralForm.get(daysRange, strings.GetStringFromName("crashesTitle"))
- .replace("#1", daysRange);
- let reportURL;
- try {
- reportURL = Services.prefs.getCharPref("breakpad.reportURL");
- // Ignore any non http/https urls
- if (!/^https?:/i.test(reportURL))
- reportURL = null;
- }
- catch (e) { }
- if (!reportURL) {
- $("crashes-noConfig").style.display = "block";
- $("crashes-noConfig").classList.remove("no-copy");
- return;
- }
- $("crashes-allReports").style.display = "block";
- $("crashes-allReports").classList.remove("no-copy");
-
- if (data.pending > 0) {
- $("crashes-allReportsWithPending").textContent =
- PluralForm.get(data.pending, strings.GetStringFromName("pendingReports"))
- .replace("#1", data.pending);
- }
-
- let dateNow = new Date();
- $.append($("crashes-tbody"), data.submitted.map(function (crash) {
- let date = new Date(crash.date);
- let timePassed = dateNow - date;
- let formattedDate;
- if (timePassed >= 24 * 60 * 60 * 1000)
- {
- let daysPassed = Math.round(timePassed / (24 * 60 * 60 * 1000));
- let daysPassedString = strings.GetStringFromName("crashesTimeDays");
- formattedDate = PluralForm.get(daysPassed, daysPassedString)
- .replace("#1", daysPassed);
- }
- else if (timePassed >= 60 * 60 * 1000)
- {
- let hoursPassed = Math.round(timePassed / (60 * 60 * 1000));
- let hoursPassedString = strings.GetStringFromName("crashesTimeHours");
- formattedDate = PluralForm.get(hoursPassed, hoursPassedString)
- .replace("#1", hoursPassed);
- }
- else
- {
- let minutesPassed = Math.max(Math.round(timePassed / (60 * 1000)), 1);
- let minutesPassedString = strings.GetStringFromName("crashesTimeMinutes");
- formattedDate = PluralForm.get(minutesPassed, minutesPassedString)
- .replace("#1", minutesPassed);
- }
- return $.new("tr", [
- $.new("td", [
- $.new("a", crash.id, null, {href : reportURL + crash.id})
- ]),
- $.new("td", formattedDate)
- ]);
- }));
+ return;
},
extensions: function extensions(data) {
@@ -151,22 +89,6 @@ var snapshotFormatters = {
}));
},
- experiments: function experiments(data) {
- $.append($("experiments-tbody"), data.map(function (experiment) {
- return $.new("tr", [
- $.new("td", experiment.name),
- $.new("td", experiment.id),
- $.new("td", experiment.description),
- $.new("td", experiment.active),
- $.new("td", experiment.endDate),
- $.new("td", [
- $.new("a", experiment.detailURL, null, {href : experiment.detailURL, })
- ]),
- $.new("td", experiment.branch),
- ]);
- }));
- },
-
modifiedPreferences: function modifiedPreferences(data) {
$.append($("prefs-tbody"), sortedArrayFromObject(data).map(
function ([name, value]) {
@@ -793,7 +715,8 @@ Serializer.prototype = {
let hasText = false;
for (let child of elem.childNodes) {
if (child.nodeType == Node.TEXT_NODE) {
- let text = this._nodeText(child);
+ let text = this._nodeText(
+ child, (child.classList && child.classList.contains("endline")));
this._appendText(text);
hasText = hasText || !!text.trim();
}
@@ -820,7 +743,7 @@ Serializer.prototype = {
}
},
- _startNewLine: function (lines) {
+ _startNewLine: function () {
let currLine = this._currentLine;
if (currLine) {
// The current line is not empty. Trim it.
@@ -832,7 +755,7 @@ Serializer.prototype = {
this._lines.push("");
},
- _appendText: function (text, lines) {
+ _appendText: function (text) {
this._currentLine += text;
},
@@ -855,7 +778,8 @@ Serializer.prototype = {
let col = tableHeadingCols[i];
if (col.localName != "th" || col.classList.contains("title-column"))
break;
- colHeadings[i] = this._nodeText(col).trim();
+ colHeadings[i] = this._nodeText(
+ col, (col.classList && col.classList.contains("endline"))).trim();
}
}
let hasColHeadings = Object.keys(colHeadings).length > 0;
@@ -882,7 +806,10 @@ Serializer.prototype = {
let text = "";
if (colHeadings[j])
text += colHeadings[j] + ": ";
- text += this._nodeText(children[j]).trim();
+ text += this._nodeText(
+ children[j],
+ (children[j].classList &&
+ children[j].classList.contains("endline"))).trim();
this._appendText(text);
this._startNewLine();
}
@@ -898,7 +825,10 @@ Serializer.prototype = {
if (this._ignoreElement(trs[i]))
continue;
let children = trs[i].querySelectorAll("th,td");
- let rowHeading = this._nodeText(children[0]).trim();
+ let rowHeading = this._nodeText(
+ children[0],
+ (children[0].classList &&
+ children[0].classList.contains("endline"))).trim();
if (children[0].classList.contains("title-column")) {
if (!this._isHiddenSubHeading(children[0]))
this._appendText(rowHeading);
@@ -912,7 +842,10 @@ Serializer.prototype = {
// queued up from querySelectorAll earlier.
this._appendText(rowHeading + ": ");
} else {
- this._appendText(rowHeading + ": " + this._nodeText(children[1]).trim());
+ this._appendText(rowHeading + ": " + this._nodeText(
+ children[1],
+ (children[1].classList &&
+ children[1].classList.contains("endline"))).trim());
}
}
this._startNewLine();
@@ -924,8 +857,16 @@ Serializer.prototype = {
return elem.classList.contains("no-copy");
},
- _nodeText: function (node) {
- return node.textContent.replace(/\s+/g, " ");
+ _nodeText: function (node, endline) {
+ let whiteChars = /\s+/g
+ let whiteCharsButNoEndline = /(?!\n)[\s]+/g;
+ let _node = node.cloneNode(true);
+ if (_node.firstElementChild &&
+ (_node.firstElementChild.nodeName.toLowerCase() == "button")) {
+ _node.removeChild(_node.firstElementChild);
+ }
+ return _node.textContent.replace(
+ endline ? whiteCharsButNoEndline : whiteChars, " ");
},
};
@@ -997,7 +938,7 @@ function setupEventListeners() {
PlacesDBUtils.checkAndFixDatabase(function(aLog) {
let msg = aLog.join("\n");
$("verify-place-result").style.display = "block";
- $("verify-place-result").classList.remove("no-copy");
+ $("verify-place-result-parent").classList.remove("no-copy");
$("verify-place-result").textContent = msg;
});
});
diff --git a/toolkit/content/aboutSupport.xhtml b/toolkit/content/aboutSupport.xhtml
index e2885c8b8..9574365a3 100644
--- a/toolkit/content/aboutSupport.xhtml
+++ b/toolkit/content/aboutSupport.xhtml
@@ -253,34 +253,6 @@
</table>
<!-- - - - - - - - - - - - - - - - - - - - - -->
-#ifdef MOZ_CRASHREPORTER
-
- <h2 class="major-section" id="crashes-title">
- &aboutSupport.crashes.title;
- </h2>
-
- <table id="crashes-table">
- <thead>
- <tr>
- <th>
- &aboutSupport.crashes.id;
- </th>
- <th>
- &aboutSupport.crashes.sendDate;
- </th>
- </tr>
- </thead>
- <tbody id="crashes-tbody">
- </tbody>
- </table>
- <p id="crashes-allReports" class="hidden no-copy">
- <a href="about:crashes" id="crashes-allReportsWithPending" class="block">&aboutSupport.crashes.allReports;</a>
- </p>
- <p id="crashes-noConfig" class="hidden no-copy">&aboutSupport.crashes.noConfig;</p>
-
-#endif
- <!-- - - - - - - - - - - - - - - - - - - - - -->
-
<h2 class="major-section">
&aboutSupport.extensionsTitle;
</h2>
@@ -435,16 +407,16 @@
</h2>
<table>
- <tr class="no-copy">
+ <tr id="verify-place-result-parent" class="no-copy">
<th class="column">
&aboutSupport.placeDatabaseIntegrity;
</th>
- <td>
+ <td class="endline">
<button id="verify-place-integrity-button">
&aboutSupport.placeDatabaseVerifyIntegrity;
</button>
- <pre id="verify-place-result" class="hidden no-copy"></pre>
+ <pre id="verify-place-result" class="hidden"></pre>
</td>
</tr>
</table>
@@ -504,39 +476,6 @@
</table>
- <h2 class="major-section">
- &aboutSupport.experimentsTitle;
- </h2>
-
- <table>
- <thead>
- <tr>
- <th>
- &aboutSupport.experimentName;
- </th>
- <th>
- &aboutSupport.experimentId;
- </th>
- <th>
- &aboutSupport.experimentDescription;
- </th>
- <th>
- &aboutSupport.experimentActive;
- </th>
- <th>
- &aboutSupport.experimentEndDate;
- </th>
- <th>
- &aboutSupport.experimentHomepage;
- </th>
- <th>
- &aboutSupport.experimentBranch;
- </th>
- </tr>
- </thead>
- <tbody id="experiments-tbody">
- </tbody>
- </table>
<!-- - - - - - - - - - - - - - - - - - - - - -->
#if defined(MOZ_SANDBOX)
diff --git a/toolkit/content/browser-child.js b/toolkit/content/browser-child.js
index c819e3db6..7d0fe18c5 100644
--- a/toolkit/content/browser-child.js
+++ b/toolkit/content/browser-child.js
@@ -17,12 +17,6 @@ Cu.import("resource://gre/modules/Timer.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "PageThumbUtils",
"resource://gre/modules/PageThumbUtils.jsm");
-if (AppConstants.MOZ_CRASHREPORTER) {
- XPCOMUtils.defineLazyServiceGetter(this, "CrashReporter",
- "@mozilla.org/xre/app-info;1",
- "nsICrashReporter");
-}
-
function makeInputStream(aString) {
let stream = Cc["@mozilla.org/io/string-input-stream;1"].
createInstance(Ci.nsISupportsCString);
@@ -174,15 +168,6 @@ var WebProgressListener = {
json.principal = content.document.nodePrincipal;
json.synthetic = content.document.mozSyntheticDocument;
json.inLoadURI = WebNavigation.inLoadURI;
-
- if (AppConstants.MOZ_CRASHREPORTER && CrashReporter.enabled) {
- let uri = aLocationURI.clone();
- try {
- // If the current URI contains a username/password, remove it.
- uri.userPass = "";
- } catch (ex) { /* Ignore failures on about: URIs. */ }
- CrashReporter.annotateCrashReport("URL", uri.spec);
- }
}
this._send("Content:LocationChange", json, objects);
@@ -310,17 +295,6 @@ var WebNavigation = {
},
loadURI: function(uri, flags, referrer, referrerPolicy, postData, headers, baseURI) {
- if (AppConstants.MOZ_CRASHREPORTER && CrashReporter.enabled) {
- let annotation = uri;
- try {
- let url = Services.io.newURI(uri, null, null);
- // If the current URI contains a username/password, remove it.
- url.userPass = "";
- annotation = url.spec;
- } catch (ex) { /* Ignore failures to parse and failures
- on about: URIs. */ }
- CrashReporter.annotateCrashReport("URL", annotation);
- }
if (referrer)
referrer = Services.io.newURI(referrer, null, null);
if (postData)
diff --git a/toolkit/content/browser-content.js b/toolkit/content/browser-content.js
index 4ae798fbd..1376f70a3 100644
--- a/toolkit/content/browser-content.js
+++ b/toolkit/content/browser-content.js
@@ -1714,6 +1714,14 @@ let DateTimePickerListener = {
(aEvent.originalTarget.type == "time" && !this.getTimePickerPref())) {
return;
}
+
+ if (this._inputElement) {
+ // This happens when we're trying to open a picker when another picker
+ // is still open. We ignore this request to let the first picker
+ // close gracefully.
+ return;
+ }
+
this._inputElement = aEvent.originalTarget;
this._inputElement.setDateTimePickerState(true);
this.addListeners();
@@ -1728,15 +1736,17 @@ let DateTimePickerListener = {
// element's value.
value: Object.keys(value).length > 0 ? value
: this._inputElement.value,
- step: this._inputElement.step,
- min: this._inputElement.min,
- max: this._inputElement.max,
+ min: this._inputElement.getMinimum(),
+ max: this._inputElement.getMaximum(),
+ step: this._inputElement.getStep(),
+ stepBase: this._inputElement.getStepBase(),
},
});
break;
}
case "MozUpdateDateTimePicker": {
let value = this._inputElement.getDateTimeInputBoxValue();
+ value.type = this._inputElement.type;
sendAsyncMessage("FormDateTime:UpdatePicker", { value });
break;
}
diff --git a/toolkit/content/customizeToolbar.js b/toolkit/content/customizeToolbar.js
index b96b60b98..7400aaadc 100644
--- a/toolkit/content/customizeToolbar.js
+++ b/toolkit/content/customizeToolbar.js
@@ -2,6 +2,8 @@
* 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/. */
+const gToolbarInfoSeparators = ["|", "-"];
+
var gToolboxDocument = null;
var gToolbox = null;
var gCurrentDragOverItem = null;
@@ -173,9 +175,20 @@ function persistCurrentSets()
// Remove custom toolbars whose contents have been removed.
gToolbox.removeChild(toolbar);
} else if (gToolbox.toolbarset) {
+ var hidingAttribute = toolbar.getAttribute("type") == "menubar" ?
+ "autohide" : "collapsed";
// Persist custom toolbar info on the <toolbarset/>
- gToolbox.toolbarset.setAttribute("toolbar"+(++customCount),
- toolbar.toolbarName + ":" + currentSet);
+ // Attributes:
+ // Names: "toolbarX" (X - the number of the toolbar)
+ // Values: "Name|HidingAttributeName-HidingAttributeValue|CurrentSet"
+ gToolbox.toolbarset.setAttribute("toolbar" + (++customCount),
+ toolbar.toolbarName
+ + gToolbarInfoSeparators[0]
+ + hidingAttribute
+ + gToolbarInfoSeparators[1]
+ + toolbar.getAttribute(hidingAttribute)
+ + gToolbarInfoSeparators[0]
+ + currentSet);
gToolboxDocument.persist(gToolbox.toolbarset.id, "toolbar"+customCount);
}
}
@@ -485,6 +498,11 @@ function addNewToolbar()
continue;
}
+ if (name.value.includes(gToolbarInfoSeparators[0])) {
+ message = stringBundle.getFormattedString("enterToolbarIllegalChars", [name.value]);
+ continue;
+ }
+
var dupeFound = false;
// Check for an existing toolbar with the same display name
@@ -506,7 +524,7 @@ function addNewToolbar()
message = stringBundle.getFormattedString("enterToolbarDup", [name.value]);
}
- gToolbox.appendCustomToolbar(name.value, "");
+ gToolbox.appendCustomToolbar(name.value, "", [null, null]);
toolboxChanged();
diff --git a/toolkit/content/datepicker.xhtml b/toolkit/content/datepicker.xhtml
new file mode 100644
index 000000000..4da6e398f
--- /dev/null
+++ b/toolkit/content/datepicker.xhtml
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html [
+ <!ENTITY % htmlDTD PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
+ %htmlDTD;
+]>
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+<head>
+ <title>Date Picker</title>
+ <link rel="stylesheet" href="chrome://global/skin/datetimeinputpickers.css"/>
+ <script type="application/javascript" src="chrome://global/content/bindings/datekeeper.js"></script>
+ <script type="application/javascript" src="chrome://global/content/bindings/spinner.js"></script>
+ <script type="application/javascript" src="chrome://global/content/bindings/calendar.js"></script>
+ <script type="application/javascript" src="chrome://global/content/bindings/datepicker.js"></script>
+</head>
+<body>
+ <div id="date-picker">
+ <div class="calendar-container">
+ <div class="nav">
+ <button class="left"/>
+ <button class="right"/>
+ </div>
+ <div class="week-header"></div>
+ <div class="days-viewport">
+ <div class="days-view"></div>
+ </div>
+ </div>
+ <div class="month-year-container">
+ <button class="month-year"/>
+ </div>
+ <div class="month-year-view"></div>
+ </div>
+ <template id="spinner-template">
+ <div class="spinner-container">
+ <button class="up"/>
+ <div class="spinner"></div>
+ <button class="down"/>
+ </div>
+ </template>
+ <script type="application/javascript">
+ // We need to hide the scroll bar but maintain its scrolling
+ // capability, so using |overflow: hidden| is not an option.
+ // Instead, we are inserting a user agent stylesheet that is
+ // capable of selecting scrollbars, and do |display: none|.
+ var domWinUtls = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
+ getInterface(Components.interfaces.nsIDOMWindowUtils);
+ domWinUtls.loadSheetUsingURIString('data:text/css,@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); scrollbar { display: none; }', domWinUtls.AGENT_SHEET);
+ // Create a DatePicker instance and prepare to be
+ // initialized by the "DatePickerInit" event from datetimepopup.xml
+ const root = document.getElementById("date-picker");
+ new DatePicker({
+ monthYear: root.querySelector(".month-year"),
+ monthYearView: root.querySelector(".month-year-view"),
+ buttonLeft: root.querySelector(".left"),
+ buttonRight: root.querySelector(".right"),
+ weekHeader: root.querySelector(".week-header"),
+ daysView: root.querySelector(".days-view")
+ });
+ </script>
+</body>
+</html> \ No newline at end of file
diff --git a/toolkit/content/jar.mn b/toolkit/content/jar.mn
index 0a0f0253b..f0d4a62a4 100644
--- a/toolkit/content/jar.mn
+++ b/toolkit/content/jar.mn
@@ -12,7 +12,7 @@ toolkit.jar:
content/global/about.xhtml
content/global/aboutAbout.js
content/global/aboutAbout.xhtml
-#ifdef MOZILLA_OFFICIAL
+#ifdef MC_OFFICIAL
content/global/aboutRights.xhtml
#else
content/global/aboutRights.xhtml (aboutRights-unbranded.xhtml)
@@ -28,7 +28,7 @@ toolkit.jar:
content/global/aboutwebrtc/aboutWebrtc.css (aboutwebrtc/aboutWebrtc.css)
content/global/aboutwebrtc/aboutWebrtc.js (aboutwebrtc/aboutWebrtc.js)
content/global/aboutwebrtc/aboutWebrtc.html (aboutwebrtc/aboutWebrtc.html)
- content/global/aboutSupport.js
+* content/global/aboutSupport.js
* content/global/aboutSupport.xhtml
content/global/aboutTelemetry.js
content/global/aboutTelemetry.xhtml
@@ -45,6 +45,7 @@ toolkit.jar:
content/global/customizeToolbar.js
content/global/customizeToolbar.xul
#endif
+ content/global/datepicker.xhtml
#ifndef MOZ_FENNEC
content/global/editMenuOverlay.js
* content/global/editMenuOverlay.xul
@@ -54,7 +55,12 @@ toolkit.jar:
#endif
content/global/filepicker.properties
content/global/globalOverlay.js
+ content/global/memoriam.xhtml
+* content/global/mozilla.css
content/global/mozilla.xhtml
+#ifdef MOZ_PHOENIX
+ content/global/logopage.xhtml
+#endif
content/global/process-content.js
content/global/resetProfile.css
content/global/resetProfile.js
@@ -75,8 +81,11 @@ toolkit.jar:
content/global/bindings/autocomplete.xml (widgets/autocomplete.xml)
content/global/bindings/browser.xml (widgets/browser.xml)
content/global/bindings/button.xml (widgets/button.xml)
+ content/global/bindings/calendar.js (widgets/calendar.js)
content/global/bindings/checkbox.xml (widgets/checkbox.xml)
content/global/bindings/colorpicker.xml (widgets/colorpicker.xml)
+ content/global/bindings/datekeeper.js (widgets/datekeeper.js)
+ content/global/bindings/datepicker.js (widgets/datepicker.js)
content/global/bindings/datetimepicker.xml (widgets/datetimepicker.xml)
content/global/bindings/datetimepopup.xml (widgets/datetimepopup.xml)
content/global/bindings/datetimebox.xml (widgets/datetimebox.xml)
diff --git a/toolkit/content/license.html b/toolkit/content/license.html
index 99ee42fde..a348fdfa6 100644
--- a/toolkit/content/license.html
+++ b/toolkit/content/license.html
@@ -87,7 +87,7 @@
<li><a href="about:license#dtoa">dtoa License</a></li>
<li><a href="about:license#hunspell-nl">Dutch Spellchecking Dictionary License</a></li>
#if defined(XP_WIN) || defined(XP_LINUX)
- <li><a href="about:license#emojione">EmojiOne License</a></li>
+ <li><a href="about:license#twemoji">Twemoji License</a></li>
#endif
<li><a href="about:license#hunspell-ee">Estonian Spellchecking Dictionary License</a></li>
<li><a href="about:license#expat">Expat License</a></li>
@@ -103,7 +103,6 @@
<li><a href="about:license#icu">ICU License</a></li>
<li><a href="about:license#immutable">Immutable.js License</a></li>
<li><a href="about:license#jpnic">Japan Network Information Center License</a></li>
- <li><a href="about:license#jemalloc">jemalloc License</a></li>
<li><a href="about:license#jquery">jQuery License</a></li>
<li><a href="about:license#k_exp">k_exp License</a></li>
<li><a href="about:license#khronos">Khronos group License</a></li>
@@ -2911,14 +2910,13 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<hr>
#if defined(XP_WIN) || defined(XP_LINUX)
- <h1><a id="emojione"></a>EmojiOne License</h1>
+ <h1><a id="twemoji"></a>Twemoji License</h1>
<p>This license applies to the emoji art contained within the bundled
emoji font file.</p>
<pre>
-Copyright (c) 2016 Ranks.com Inc.
-Copyright (c) 2014 Twitter, Inc and other contributors.
+Copyright (c) 2018 Twitter, Inc and other contributors.
Creative Commons Attribution 4.0 International (CC BY 4.0)
@@ -3528,46 +3526,6 @@ Chiyoda-ku, Tokyo 101-0047, Japan.
<hr>
- <h1><a id="jemalloc"></a>jemalloc License</h1>
-
- <p>This license applies to files in the directories
- <span class="path">memory/mozjemalloc/</span> and
- <span class="path">memory/jemalloc/</span>.
- </p>
-
-<pre>
-Copyright (C) 2002-2012 Jason Evans &lt;jasone@canonware.com&gt;.
-All rights reserved.
-Copyright (C) 2007-2012 Mozilla Foundation. All rights reserved.
-Copyright (C) 2009-2012 Facebook, Inc. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-1. Redistributions of source code must retain the above copyright
- notice(s), this list of conditions and the following disclaimer as
- the first lines of this file unmodified other than the possible
- addition of one or more copyright notices.
-2. Redistributions in binary form must reproduce the above copyright
- notice(s), this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
-EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE
-LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
-BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
-OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
-EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-</pre>
-
- <hr>
-
<h1><a id="jquery"></a>jQuery License</h1>
<p>This license applies to all copies of jQuery in the code.</p>
diff --git a/toolkit/content/logopage.xhtml b/toolkit/content/logopage.xhtml
new file mode 100644
index 000000000..bcf1da0f0
--- /dev/null
+++ b/toolkit/content/logopage.xhtml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
+ "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd" [
+]>
+
+<!-- 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/. -->
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+ <title></title>
+ <style type="text/css">
+ body {
+ background: Menu;
+ color: MenuText;
+ }
+
+ img {
+ text-align: center;
+ position: absolute;
+ margin: auto;
+ top: 0;
+ right: 0;
+ bottom: 0;
+ left: 0;
+ opacity: 0.2;
+ }
+ </style>
+</head>
+
+<body>
+ <img src="about:logo" alt=""/>
+</body>
+</html>
diff --git a/toolkit/content/memoriam.xhtml b/toolkit/content/memoriam.xhtml
new file mode 100644
index 000000000..f1a1b474d
--- /dev/null
+++ b/toolkit/content/memoriam.xhtml
@@ -0,0 +1,76 @@
+<!DOCTYPE html
+[
+ <!ENTITY % directionDTD SYSTEM "chrome://global/locale/global.dtd" >
+ %directionDTD;
+ <!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd">
+ %brandDTD;
+]>
+
+<!-- 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/. -->
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <meta charset='utf-8' />
+ <title>Mozilla: In Memoriam</title>
+
+<style>
+html {
+ background: maroon radial-gradient( circle, #a01010 0%, #800000 80%) center center / cover no-repeat;
+ color: white;
+ font-style: italic;
+ text-rendering: optimizeLegibility;
+ min-height: 100%;
+}
+
+#moztext {
+ margin-top: 15%;
+ font-size: 1.1em;
+ font-family: serif;
+ text-align: center;
+ line-height: 1.5;
+}
+
+#from {
+ font-size: 1.0em;
+ font-family: serif;
+ text-align: right;
+}
+
+em {
+ font-size: 1.3em;
+ line-height: 0;
+}
+
+a {
+ text-decoration: none;
+ color: white;
+}
+</style>
+</head>
+
+<body dir="&locale.dir;">
+
+<section>
+ <p id="moztext">
+ <h1>Mozilla: In Memoriam</h1>
+ <br/>
+ Dedicated to the tireless developers who have come and gone.<br/>
+ To those who have put their heart and soul into Mozilla products.<br/>
+ To those who have seen their good intentions and hard work squandered.<br/>
+ To those who really cared about the user, and cared about usability.<br/>
+ To those who truly understood us and desired freedom, but were unheard.<br/>
+ To those who knew that change is inevitable, but loss of vision is not.<br/>
+ To those who were forced to give up the good fight.<br/>
+ <br/>
+ <em>Thank you.</em> &brandFullName; would not have been possible without you.<br/>
+ <br/>
+ </p>
+
+ <p id="from">
+ </p>
+</section>
+
+</body>
+</html> \ No newline at end of file
diff --git a/toolkit/content/mozilla.css b/toolkit/content/mozilla.css
new file mode 100644
index 000000000..d5eae6415
--- /dev/null
+++ b/toolkit/content/mozilla.css
@@ -0,0 +1,36 @@
+html {
+%ifdef MC_PALEMOON
+ background: #333399 radial-gradient( circle at 75% 25%, #6666b0 0%, #333399 40%, #111177 80%) center center / cover no-repeat;
+%else
+ background: maroon radial-gradient( circle, #a01010 0%, #800000 80%) center center / cover no-repeat;
+%endif
+
+ color: white;
+ font-style: italic;
+ text-rendering: optimizeLegibility;
+ min-height: 100%;
+}
+
+#moztext {
+ margin-top: 15%;
+ font-size: 1.1em;
+ font-family: serif;
+ text-align: center;
+ line-height: 1.5;
+}
+
+#from {
+ font-size: 1.95em;
+ font-family: serif;
+ text-align: right;
+}
+
+em {
+ font-size: 1.3em;
+ line-height: 0;
+}
+
+a {
+ text-decoration: none;
+ color: white;
+} \ No newline at end of file
diff --git a/toolkit/content/mozilla.xhtml b/toolkit/content/mozilla.xhtml
index 2acfc9f5d..8c79b5ff9 100644
--- a/toolkit/content/mozilla.xhtml
+++ b/toolkit/content/mozilla.xhtml
@@ -15,39 +15,8 @@
<meta charset='utf-8' />
<title>&chronicles.title.55.2;</title>
-<style>
-html {
- background: maroon radial-gradient( circle, #a01010 0%, #800000 80%) center center / cover no-repeat;
- color: white;
- font-style: italic;
- text-rendering: optimizeLegibility;
- min-height: 100%;
-}
-
-#moztext {
- margin-top: 15%;
- font-size: 1.1em;
- font-family: serif;
- text-align: center;
- line-height: 1.5;
-}
-
-#from {
- font-size: 1.95em;
- font-family: serif;
- text-align: right;
-}
-
-em {
- font-size: 1.3em;
- line-height: 0;
-}
-
-a {
- text-decoration: none;
- color: white;
-}
-</style>
+ <link rel="stylesheet" href="chrome://global/content/mozilla.css"
+ type="text/css"/>
</head>
<body dir="&locale.dir;">
diff --git a/toolkit/content/plugins.html b/toolkit/content/plugins.html
index 84cbba596..15bbed9bb 100644
--- a/toolkit/content/plugins.html
+++ b/toolkit/content/plugins.html
@@ -10,6 +10,7 @@
"use strict";
Components.utils.import("resource://gre/modules/Services.jsm");
+ Components.utils.import("resource://gre/modules/AddonManager.jsm");
var Ci = Components.interfaces;
var strBundleService = Components.classes["@mozilla.org/intl/stringbundle;1"].getService(Ci.nsIStringBundleService);
@@ -57,7 +58,7 @@
*/
navigator.plugins.refresh(false);
- addMessageListener("PluginList", function({ data: aPlugins }) {
+ AddonManager.getAddonsByTypes(["plugin"], function (aPlugins) {
var fragment = document.createDocumentFragment();
// "Installed plugins"
@@ -74,15 +75,6 @@
enabledplugins.appendChild(document.createTextNode(pluginsbundle.GetStringFromName(label)));
fragment.appendChild(enabledplugins);
- var deprecation = document.createElement("p");
- deprecation.setAttribute("class", "notice");
- deprecation.textContent = pluginsbundle.GetStringFromName("deprecation_description") + " \u00A0 ";
- var deprecationLink = document.createElement("a");
- deprecationLink.textContent = pluginsbundle.GetStringFromName("deprecation_learn_more");
- deprecationLink.href = Services.urlFormatter.formatURLPref("app.support.baseURL") + "npapi";
- deprecation.appendChild(deprecationLink);
- fragment.appendChild(deprecation);
-
var stateNames = {};
["STATE_SOFTBLOCKED",
"STATE_BLOCKED",
@@ -209,8 +201,6 @@
document.getElementById("outside").appendChild(fragment);
});
-
- sendAsyncMessage("RequestPlugins");
</script>
</div>
</body>
diff --git a/toolkit/content/tests/browser/browser.ini b/toolkit/content/tests/browser/browser.ini
index 278b2ffe0..67ba2f850 100644
--- a/toolkit/content/tests/browser/browser.ini
+++ b/toolkit/content/tests/browser/browser.ini
@@ -26,6 +26,7 @@ skip-if = !e10s
[browser_contentTitle.js]
[browser_crash_previous_frameloader.js]
run-if = e10s && crashreporter
+[browser_datetime_datepicker.js]
[browser_default_image_filename.js]
[browser_f7_caret_browsing.js]
[browser_findbar.js]
diff --git a/toolkit/content/tests/browser/browser_datetime_datepicker.js b/toolkit/content/tests/browser/browser_datetime_datepicker.js
new file mode 100644
index 000000000..966a74e7a
--- /dev/null
+++ b/toolkit/content/tests/browser/browser_datetime_datepicker.js
@@ -0,0 +1,284 @@
+/* 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/. */
+
+"use strict";
+
+const MONTH_YEAR = ".month-year",
+ DAYS_VIEW = ".days-view",
+ BTN_PREV_MONTH = ".prev",
+ BTN_NEXT_MONTH = ".next";
+const DATE_FORMAT = new Intl.DateTimeFormat("en-US", { year: "numeric", month: "long", timeZone: "UTC" }).format;
+
+// Create a list of abbreviations for calendar class names
+const W = "weekend",
+ O = "outside",
+ S = "selection",
+ R = "out-of-range",
+ T = "today",
+ P = "off-step";
+
+// Calendar classlist for 2016-12. Used to verify the classNames are correct.
+const calendarClasslist_201612 = [
+ [W, O], [O], [O], [O], [], [], [W],
+ [W], [], [], [], [], [], [W],
+ [W], [], [], [], [S], [], [W],
+ [W], [], [], [], [], [], [W],
+ [W], [], [], [], [], [], [W],
+ [W, O], [O], [O], [O], [O], [O], [W, O],
+];
+
+function getCalendarText() {
+ return helper.getChildren(DAYS_VIEW).map(child => child.textContent);
+}
+
+function getCalendarClassList() {
+ return helper.getChildren(DAYS_VIEW).map(child => Array.from(child.classList));
+}
+
+function mergeArrays(a, b) {
+ return a.map((classlist, index) => classlist.concat(b[index]));
+}
+
+let helper = new DateTimeTestHelper();
+
+registerCleanupFunction(() => {
+ helper.cleanup();
+});
+
+/**
+ * Test that date picker opens to today's date when input field is blank
+ */
+add_task(async function test_datepicker_today() {
+ const date = new Date();
+
+ await helper.openPicker("data:text/html, <input type='date'>");
+
+ Assert.equal(helper.getElement(MONTH_YEAR).textContent, DATE_FORMAT(date));
+
+ await helper.tearDown();
+});
+
+/**
+ * Test that date picker opens to the correct month, with calendar days
+ * displayed correctly, given a date value is set.
+ */
+add_task(async function test_datepicker_open() {
+ const inputValue = "2016-12-15";
+
+ await helper.openPicker(`data:text/html, <input type="date" value="${inputValue}">`);
+
+ Assert.equal(helper.getElement(MONTH_YEAR).textContent, DATE_FORMAT(new Date(inputValue)));
+ Assert.deepEqual(
+ getCalendarText(),
+ [
+ "27", "28", "29", "30", "1", "2", "3",
+ "4", "5", "6", "7", "8", "9", "10",
+ "11", "12", "13", "14", "15", "16", "17",
+ "18", "19", "20", "21", "22", "23", "24",
+ "25", "26", "27", "28", "29", "30", "31",
+ "1", "2", "3", "4", "5", "6", "7",
+ ],
+ "2016-12",
+ );
+ Assert.deepEqual(
+ getCalendarClassList(),
+ calendarClasslist_201612,
+ "2016-12 classNames"
+ );
+
+ await helper.tearDown();
+});
+
+/**
+ * When the prev month button is clicked, calendar should display the dates for
+ * the previous month.
+ */
+add_task(async function test_datepicker_prev_month_btn() {
+ const inputValue = "2016-12-15";
+ const prevMonth = "2016-11-01";
+
+ await helper.openPicker(`data:text/html, <input type="date" value="${inputValue}">`);
+ helper.click(helper.getElement(BTN_PREV_MONTH));
+
+ Assert.equal(helper.getElement(MONTH_YEAR).textContent, DATE_FORMAT(new Date(prevMonth)));
+ Assert.deepEqual(
+ getCalendarText(),
+ [
+ "30", "31", "1", "2", "3", "4", "5",
+ "6", "7", "8", "9", "10", "11", "12",
+ "13", "14", "15", "16", "17", "18", "19",
+ "20", "21", "22", "23", "24", "25", "26",
+ "27", "28", "29", "30", "1", "2", "3",
+ "4", "5", "6", "7", "8", "9", "10",
+ ],
+ "2016-11",
+ );
+
+ await helper.tearDown();
+});
+
+/**
+ * When the next month button is clicked, calendar should display the dates for
+ * the next month.
+ */
+add_task(async function test_datepicker_next_month_btn() {
+ const inputValue = "2016-12-15";
+ const nextMonth = "2017-01-01";
+
+ await helper.openPicker(`data:text/html, <input type="date" value="${inputValue}">`);
+ helper.click(helper.getElement(BTN_NEXT_MONTH));
+
+ Assert.equal(helper.getElement(MONTH_YEAR).textContent, DATE_FORMAT(new Date(nextMonth)));
+ Assert.deepEqual(
+ getCalendarText(),
+ [
+ "25", "26", "27", "28", "29", "30", "31",
+ "1", "2", "3", "4", "5", "6", "7",
+ "8", "9", "10", "11", "12", "13", "14",
+ "15", "16", "17", "18", "19", "20", "21",
+ "22", "23", "24", "25", "26", "27", "28",
+ "29", "30", "31", "1", "2", "3", "4",
+ ],
+ "2017-01",
+ );
+
+ await helper.tearDown();
+});
+
+/**
+ * When a date on the calendar is clicked, date picker should close and set
+ * value to the input box.
+ */
+add_task(async function test_datepicker_clicked() {
+ const inputValue = "2016-12-15";
+ const firstDayOnCalendar = "2016-11-27";
+
+ await helper.openPicker(`data:text/html, <input type="date" value="${inputValue}">`);
+ // Click the first item (top-left corner) of the calendar
+ helper.click(helper.getElement(DAYS_VIEW).children[0]);
+ await ContentTask.spawn(helper.tab.linkedBrowser, {}, async function() {
+ let inputEl = content.document.querySelector("input");
+ await ContentTaskUtils.waitForEvent(inputEl, "input");
+ });
+
+ Assert.equal(content.document.querySelector("input").value, firstDayOnCalendar);
+
+ await helper.tearDown();
+});
+
+/**
+ * Make sure picker is in correct state when it is reopened.
+ */
+add_task(async function test_datepicker_reopen_state() {
+ const inputValue = "2016-12-15";
+ const nextMonth = "2017-01-01";
+
+ await helper.openPicker(`data:text/html, <input type="date" value="${inputValue}">`);
+ // Navigate to the next month but does not commit the change
+ Assert.equal(helper.getElement(MONTH_YEAR).textContent, DATE_FORMAT(new Date(inputValue)));
+ helper.click(helper.getElement(BTN_NEXT_MONTH));
+ Assert.equal(helper.getElement(MONTH_YEAR).textContent, DATE_FORMAT(new Date(nextMonth)));
+ EventUtils.synthesizeKey("VK_ESCAPE", {}, window);
+
+ // Ensures the picker opens to the month of the input value
+ await BrowserTestUtils.synthesizeMouseAtCenter("input", {}, gBrowser.selectedBrowser);
+ await helper.waitForPickerReady();
+ Assert.equal(helper.getElement(MONTH_YEAR).textContent, DATE_FORMAT(new Date(inputValue)));
+
+ await helper.tearDown();
+});
+
+/**
+ * When min and max attributes are set, calendar should show some dates as
+ * out-of-range.
+ */
+add_task(async function test_datepicker_min_max() {
+ const inputValue = "2016-12-15";
+ const inputMin = "2016-12-05";
+ const inputMax = "2016-12-25";
+
+ await helper.openPicker(`data:text/html, <input type="date" value="${inputValue}" min="${inputMin}" max="${inputMax}">`);
+
+ Assert.deepEqual(
+ getCalendarClassList(),
+ mergeArrays(calendarClasslist_201612, [
+ // R denotes out-of-range
+ [R], [R], [R], [R], [R], [R], [R],
+ [R], [], [], [], [], [], [],
+ [], [], [], [], [], [], [],
+ [], [], [], [], [], [], [],
+ [], [R], [R], [R], [R], [R], [R],
+ [R], [R], [R], [R], [R], [R], [R],
+ ]),
+ "2016-12 with min & max",
+ );
+
+ await helper.tearDown();
+});
+
+/**
+ * When step attribute is set, calendar should show some dates as off-step.
+ */
+add_task(async function test_datepicker_step() {
+ const inputValue = "2016-12-15";
+ const inputStep = "5";
+
+ await helper.openPicker(`data:text/html, <input type="date" value="${inputValue}" step="${inputStep}">`);
+
+ Assert.deepEqual(
+ getCalendarClassList(),
+ mergeArrays(calendarClasslist_201612, [
+ // P denotes off-step
+ [P], [P], [P], [], [P], [P], [P],
+ [P], [], [P], [P], [P], [P], [],
+ [P], [P], [P], [P], [], [P], [P],
+ [P], [P], [], [P], [P], [P], [P],
+ [], [P], [P], [P], [P], [], [P],
+ [P], [P], [P], [], [P], [P], [P],
+ ]),
+ "2016-12 with step",
+ );
+
+ await helper.tearDown();
+});
+
+add_task(async function test_datepicker_abs_min() {
+ const inputValue = "0001-01-01";
+ await helper.openPicker(`data:text/html, <input type="date" value="${inputValue}">`);
+
+ Assert.deepEqual(
+ getCalendarText(),
+ [
+ "", "1", "2", "3", "4", "5", "6",
+ "7", "8", "9", "10", "11", "12", "13",
+ "14", "15", "16", "17", "18", "19", "20",
+ "21", "22", "23", "24", "25", "26", "27",
+ "28", "29", "30", "31", "1", "2", "3",
+ "4", "5", "6", "7", "8", "9", "10",
+ ],
+ "0001-01",
+ );
+
+ await helper.tearDown();
+});
+
+add_task(async function test_datepicker_abs_max() {
+ const inputValue = "275760-09-13";
+ await helper.openPicker(`data:text/html, <input type="date" value="${inputValue}">`);
+
+ Assert.deepEqual(
+ getCalendarText(),
+ [
+ "31", "1", "2", "3", "4", "5", "6",
+ "7", "8", "9", "10", "11", "12", "13",
+ "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "",
+ ],
+ "275760-09",
+ );
+
+ await helper.tearDown();
+});
diff --git a/toolkit/content/tests/browser/head.js b/toolkit/content/tests/browser/head.js
index 1c6c2b54f..d7ed7a9ff 100644
--- a/toolkit/content/tests/browser/head.js
+++ b/toolkit/content/tests/browser/head.js
@@ -31,3 +31,93 @@ function pushPrefs(...aPrefs) {
SpecialPowers.pushPrefEnv({"set": aPrefs}, deferred.resolve);
return deferred.promise;
}
+
+/**
+ * Helper class for testing datetime input picker widget
+ */
+class DateTimeTestHelper {
+ constructor() {
+ this.panel = document.getElementById("DateTimePickerPanel");
+ this.panel.setAttribute("animate", false);
+ this.tab = null;
+ this.frame = null;
+ }
+
+ /**
+ * Opens a new tab with the URL of the test page, and make sure the picker is
+ * ready for testing.
+ *
+ * @param {String} pageUrl
+ */
+ async openPicker(pageUrl) {
+ this.tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, pageUrl);
+ await BrowserTestUtils.synthesizeMouseAtCenter("input", {}, gBrowser.selectedBrowser);
+ // If dateTimePopupFrame doesn't exist yet, wait for the binding to be attached
+ if (!this.panel.dateTimePopupFrame) {
+ await BrowserTestUtils.waitForEvent(this.panel, "DateTimePickerBindingReady")
+ }
+ this.frame = this.panel.dateTimePopupFrame;
+ await this.waitForPickerReady();
+ }
+
+ async waitForPickerReady() {
+ await BrowserTestUtils.waitForEvent(this.frame, "load", true);
+ // Wait for picker elements to be ready
+ await BrowserTestUtils.waitForEvent(this.frame.contentDocument, "PickerReady");
+ }
+
+ /**
+ * Find an element on the picker.
+ *
+ * @param {String} selector
+ * @return {DOMElement}
+ */
+ getElement(selector) {
+ return this.frame.contentDocument.querySelector(selector);
+ }
+
+ /**
+ * Find the children of an element on the picker.
+ *
+ * @param {String} selector
+ * @return {Array<DOMElement>}
+ */
+ getChildren(selector) {
+ return Array.from(this.getElement(selector).children);
+ }
+
+ /**
+ * Click on an element
+ *
+ * @param {DOMElement} element
+ */
+ click(element) {
+ EventUtils.synthesizeMouseAtCenter(element, {}, this.frame.contentWindow);
+ }
+
+ /**
+ * Close the panel and the tab
+ */
+ async tearDown() {
+ if (!this.panel.hidden) {
+ let pickerClosePromise = new Promise(resolve => {
+ this.panel.addEventListener("popuphidden", resolve, {once: true});
+ });
+ this.panel.hidePopup();
+ this.panel.closePicker();
+ await pickerClosePromise;
+ }
+ await BrowserTestUtils.removeTab(this.tab);
+ this.tab = null;
+ }
+
+ /**
+ * Clean up after tests. Remove the frame to prevent leak.
+ */
+ cleanup() {
+ this.frame.remove();
+ this.frame = null;
+ this.panel.removeAttribute("animate");
+ this.panel = null;
+ }
+}
diff --git a/toolkit/content/timepicker.xhtml b/toolkit/content/timepicker.xhtml
index 1396223f1..77b9fba41 100644
--- a/toolkit/content/timepicker.xhtml
+++ b/toolkit/content/timepicker.xhtml
@@ -6,7 +6,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<head>
<title>Time Picker</title>
- <link rel="stylesheet" href="chrome://global/skin/timepicker.css"/>
+ <link rel="stylesheet" href="chrome://global/skin/datetimeinputpickers.css"/>
<script type="application/javascript" src="chrome://global/content/bindings/timekeeper.js"></script>
<script type="application/javascript" src="chrome://global/content/bindings/spinner.js"></script>
<script type="application/javascript" src="chrome://global/content/bindings/timepicker.js"></script>
diff --git a/toolkit/content/widgets/calendar.js b/toolkit/content/widgets/calendar.js
new file mode 100644
index 000000000..44ba67501
--- /dev/null
+++ b/toolkit/content/widgets/calendar.js
@@ -0,0 +1,171 @@
+/* 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/. */
+
+"use strict";
+
+/**
+ * Initialize the Calendar and generate nodes for week headers and days, and
+ * attach event listeners.
+ *
+ * @param {Object} options
+ * {
+ * {Number} calViewSize: Number of days to appear on a calendar view
+ * {Function} getDayString: Transform day number to string
+ * {Function} getWeekHeaderString: Transform day of week number to string
+ * {Function} setSelection: Set selection for dateKeeper
+ * }
+ * @param {Object} context
+ * {
+ * {DOMElement} weekHeader
+ * {DOMElement} daysView
+ * }
+ */
+function Calendar(options, context) {
+ const DAYS_IN_A_WEEK = 7;
+
+ this.context = context;
+ this.state = {
+ days: [],
+ weekHeaders: [],
+ setSelection: options.setSelection,
+ getDayString: options.getDayString,
+ getWeekHeaderString: options.getWeekHeaderString
+ };
+ this.elements = {
+ weekHeaders: this._generateNodes(DAYS_IN_A_WEEK, context.weekHeader),
+ daysView: this._generateNodes(options.calViewSize, context.daysView)
+ };
+
+ this._attachEventListeners();
+}
+
+{
+ Calendar.prototype = {
+
+ /**
+ * Set new properties and render them.
+ *
+ * @param {Object} props
+ * {
+ * {Boolean} isVisible: Whether or not the calendar is in view
+ * {Array<Object>} days: Data for days
+ * {
+ * {Date} dateObj
+ * {Number} content
+ * {Array<String>} classNames
+ * {Boolean} enabled
+ * }
+ * {Array<Object>} weekHeaders: Data for weekHeaders
+ * {
+ * {Number} content
+ * {Array<String>} classNames
+ * }
+ * }
+ */
+ setProps(props) {
+ if (props.isVisible) {
+ // Transform the days and weekHeaders array for rendering
+ const days = props.days.map(({ dateObj, content, classNames, enabled }) => {
+ return {
+ dateObj,
+ textContent: this.state.getDayString(content),
+ className: classNames.join(" "),
+ enabled
+ };
+ });
+ const weekHeaders = props.weekHeaders.map(({ content, classNames }) => {
+ return {
+ textContent: this.state.getWeekHeaderString(content),
+ className: classNames.join(" ")
+ };
+ });
+ // Update the DOM nodes states
+ this._render({
+ elements: this.elements.daysView,
+ items: days,
+ prevState: this.state.days
+ });
+ this._render({
+ elements: this.elements.weekHeaders,
+ items: weekHeaders,
+ prevState: this.state.weekHeaders,
+ });
+ // Update the state to current
+ this.state.days = days;
+ this.state.weekHeaders = weekHeaders;
+ }
+ },
+
+ /**
+ * Render the items onto the DOM nodes
+ * @param {Object}
+ * {
+ * {Array<DOMElement>} elements
+ * {Array<Object>} items
+ * {Array<Object>} prevState: state of items from last render
+ * }
+ */
+ _render({ elements, items, prevState }) {
+ for (let i = 0, l = items.length; i < l; i++) {
+ let el = elements[i];
+
+ // Check if state from last render has changed, if so, update the elements
+ if (!prevState[i] || prevState[i].textContent != items[i].textContent) {
+ el.textContent = items[i].textContent;
+ }
+ if (!prevState[i] || prevState[i].className != items[i].className) {
+ el.className = items[i].className;
+ }
+ }
+ },
+
+ /**
+ * Generate DOM nodes
+ *
+ * @param {Number} size: Number of nodes to generate
+ * @param {DOMElement} context: Element to append the nodes to
+ * @return {Array<DOMElement>}
+ */
+ _generateNodes(size, context) {
+ let frag = document.createDocumentFragment();
+ let refs = [];
+
+ for (let i = 0; i < size; i++) {
+ let el = document.createElement("div");
+ el.dataset.id = i;
+ refs.push(el);
+ frag.appendChild(el);
+ }
+ context.appendChild(frag);
+
+ return refs;
+ },
+
+ /**
+ * Handle events
+ * @param {DOMEvent} event
+ */
+ handleEvent(event) {
+ switch (event.type) {
+ case "click": {
+ if (event.target.parentNode == this.context.daysView) {
+ let targetId = event.target.dataset.id;
+ let targetObj = this.state.days[targetId];
+ if (targetObj.enabled) {
+ this.state.setSelection(targetObj.dateObj);
+ }
+ }
+ break;
+ }
+ }
+ },
+
+ /**
+ * Attach event listener to daysView
+ */
+ _attachEventListeners() {
+ this.context.daysView.addEventListener("click", this);
+ }
+ };
+}
diff --git a/toolkit/content/widgets/datekeeper.js b/toolkit/content/widgets/datekeeper.js
new file mode 100644
index 000000000..5d70416a9
--- /dev/null
+++ b/toolkit/content/widgets/datekeeper.js
@@ -0,0 +1,336 @@
+/* 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/. */
+
+"use strict";
+
+/**
+ * DateKeeper keeps track of the date states.
+ */
+function DateKeeper(props) {
+ this.init(props);
+}
+
+{
+ const DAYS_IN_A_WEEK = 7,
+ MONTHS_IN_A_YEAR = 12,
+ YEAR_VIEW_SIZE = 200,
+ YEAR_BUFFER_SIZE = 10,
+ // The min value is 0001-01-01 based on HTML spec:
+ // https://html.spec.whatwg.org/#valid-date-string
+ MIN_DATE = -62135596800000,
+ // The max value is derived from the ECMAScript spec (275760-09-13):
+ // http://ecma-international.org/ecma-262/5.1/#sec-15.9.1.1
+ MAX_DATE = 8640000000000000,
+ MAX_YEAR = 275760,
+ MAX_MONTH = 9;
+
+ DateKeeper.prototype = {
+ get year() {
+ return this.state.dateObj.getUTCFullYear();
+ },
+
+ get month() {
+ return this.state.dateObj.getUTCMonth();
+ },
+
+ get selection() {
+ return this.state.selection;
+ },
+
+ /**
+ * Initialize DateKeeper
+ * @param {Number} year
+ * @param {Number} month
+ * @param {Number} day
+ * @param {Number} min
+ * @param {Number} max
+ * @param {Number} step
+ * @param {Number} stepBase
+ * @param {Number} firstDayOfWeek
+ * @param {Array<Number>} weekends
+ * @param {Number} calViewSize
+ */
+ init({ year, month, day, min, max, step, stepBase, firstDayOfWeek = 0, weekends = [0], calViewSize = 42 }) {
+ const today = new Date();
+
+ this.state = {
+ step, firstDayOfWeek, weekends, calViewSize,
+ // min & max are NaN if empty or invalid
+ min: new Date(Number.isNaN(min) ? MIN_DATE : min),
+ max: new Date(Number.isNaN(max) ? MAX_DATE : max),
+ stepBase: new Date(stepBase),
+ today: this._newUTCDate(today.getFullYear(), today.getMonth(), today.getDate()),
+ weekHeaders: this._getWeekHeaders(firstDayOfWeek, weekends),
+ years: [],
+ dateObj: new Date(0),
+ selection: { year, month, day },
+ };
+
+ this.setCalendarMonth({
+ year: year === undefined ? today.getFullYear() : year,
+ month: month === undefined ? today.getMonth() : month
+ });
+ },
+ /**
+ * Set new calendar month. The year is always treated as full year, so the
+ * short-form is not supported.
+ * @param {Object} date parts
+ * {
+ * {Number} year [optional]
+ * {Number} month [optional]
+ * }
+ */
+ setCalendarMonth({ year = this.year, month = this.month }) {
+ // Make sure the date is valid before setting.
+ // Use setUTCFullYear so that year 99 doesn't get parsed as 1999
+ if (year > MAX_YEAR || year === MAX_YEAR && month >= MAX_MONTH) {
+ this.state.dateObj.setUTCFullYear(MAX_YEAR, MAX_MONTH - 1, 1);
+ } else if (year < 1 || year === 1 && month < 0) {
+ this.state.dateObj.setUTCFullYear(1, 0, 1);
+ } else {
+ this.state.dateObj.setUTCFullYear(year, month, 1);
+ }
+ },
+
+ /**
+ * Set selection date
+ * @param {Number} year
+ * @param {Number} month
+ * @param {Number} day
+ */
+ setSelection({ year, month, day }) {
+ this.state.selection.year = year;
+ this.state.selection.month = month;
+ this.state.selection.day = day;
+ },
+
+ /**
+ * Set month. Makes sure the day is <= the last day of the month
+ * @param {Number} month
+ */
+ setMonth(month) {
+ this.setCalendarMonth({ year: this.year, month });
+ },
+
+ /**
+ * Set year. Makes sure the day is <= the last day of the month
+ * @param {Number} year
+ */
+ setYear(year) {
+ this.setCalendarMonth({ year, month: this.month });
+ },
+
+ /**
+ * Set month by offset. Makes sure the day is <= the last day of the month
+ * @param {Number} offset
+ */
+ setMonthByOffset(offset) {
+ this.setCalendarMonth({ year: this.year, month: this.month + offset });
+ },
+
+ /**
+ * Generate the array of months
+ * @return {Array<Object>}
+ * {
+ * {Number} value: Month in int
+ * {Boolean} enabled
+ * }
+ */
+ getMonths() {
+ let months = [];
+
+ for (let i = 0; i < MONTHS_IN_A_YEAR; i++) {
+ months.push({
+ value: i,
+ enabled: true
+ });
+ }
+
+ return months;
+ },
+
+ /**
+ * Generate the array of years
+ * @return {Array<Object>}
+ * {
+ * {Number} value: Year in int
+ * {Boolean} enabled
+ * }
+ */
+ getYears() {
+ let years = [];
+
+ const firstItem = this.state.years[0];
+ const lastItem = this.state.years[this.state.years.length - 1];
+ const currentYear = this.year;
+
+ // Generate new years array when the year is outside of the first &
+ // last item range. If not, return the cached result.
+ if (!firstItem || !lastItem ||
+ currentYear <= firstItem.value + YEAR_BUFFER_SIZE ||
+ currentYear >= lastItem.value - YEAR_BUFFER_SIZE) {
+ // The year is set in the middle with items on both directions
+ for (let i = -(YEAR_VIEW_SIZE / 2); i < YEAR_VIEW_SIZE / 2; i++) {
+ const year = currentYear + i;
+ if (year >= 1 && year <= MAX_YEAR) {
+ years.push({
+ value: year,
+ enabled: true
+ });
+ }
+ }
+ this.state.years = years;
+ }
+ return this.state.years;
+ },
+
+ /**
+ * Get days for calendar
+ * @return {Array<Object>}
+ * {
+ * {Date} dateObj
+ * {Number} content
+ * {Array<String>} classNames
+ * {Boolean} enabled
+ * }
+ */
+ getDays() {
+ const firstDayOfMonth = this._getFirstCalendarDate(this.state.dateObj, this.state.firstDayOfWeek);
+ const month = this.month;
+ let days = [];
+
+ for (let i = 0; i < this.state.calViewSize; i++) {
+ const dateObj = this._newUTCDate(firstDayOfMonth.getUTCFullYear(),
+ firstDayOfMonth.getUTCMonth(),
+ firstDayOfMonth.getUTCDate() + i);
+
+ let classNames = [];
+ let enabled = true;
+
+ const isValid = dateObj.getTime() >= MIN_DATE && dateObj.getTime() <= MAX_DATE;
+ if (!isValid) {
+ classNames.push("out-of-range");
+ enabled = false;
+
+ days.push({
+ classNames,
+ enabled,
+ });
+ continue;
+ }
+
+ const isWeekend = this.state.weekends.includes(dateObj.getUTCDay());
+ const isCurrentMonth = month == dateObj.getUTCMonth();
+ const isSelection = this.state.selection.year == dateObj.getUTCFullYear() &&
+ this.state.selection.month == dateObj.getUTCMonth() &&
+ this.state.selection.day == dateObj.getUTCDate();
+ const isOutOfRange = dateObj.getTime() < this.state.min.getTime() ||
+ dateObj.getTime() > this.state.max.getTime();
+ const isToday = this.state.today.getTime() == dateObj.getTime();
+ const isOffStep = this._checkIsOffStep(dateObj,
+ this._newUTCDate(dateObj.getUTCFullYear(),
+ dateObj.getUTCMonth(),
+ dateObj.getUTCDate() + 1));
+
+ if (isWeekend) {
+ classNames.push("weekend");
+ }
+ if (!isCurrentMonth) {
+ classNames.push("outside");
+ }
+ if (isSelection && !isOutOfRange && !isOffStep) {
+ classNames.push("selection");
+ }
+ if (isOutOfRange) {
+ classNames.push("out-of-range");
+ enabled = false;
+ }
+ if (isToday) {
+ classNames.push("today");
+ }
+ if (isOffStep) {
+ classNames.push("off-step");
+ enabled = false;
+ }
+ days.push({
+ dateObj,
+ content: dateObj.getUTCDate(),
+ classNames,
+ enabled,
+ });
+ }
+ return days;
+ },
+
+ /**
+ * Check if a date is off step given a starting point and the next increment
+ * @param {Date} start
+ * @param {Date} next
+ * @return {Boolean}
+ */
+ _checkIsOffStep(start, next) {
+ // If the increment is larger or equal to the step, it must not be off-step.
+ if (next - start >= this.state.step) {
+ return false;
+ }
+ // Calculate the last valid date
+ const lastValidStep = Math.floor((next - 1 - this.state.stepBase) / this.state.step);
+ const lastValidTimeInMs = lastValidStep * this.state.step + this.state.stepBase.getTime();
+ // The date is off-step if the last valid date is smaller than the start date
+ return lastValidTimeInMs < start.getTime();
+ },
+
+ /**
+ * Get week headers for calendar
+ * @param {Number} firstDayOfWeek
+ * @param {Array<Number>} weekends
+ * @return {Array<Object>}
+ * {
+ * {Number} content
+ * {Array<String>} classNames
+ * }
+ */
+ _getWeekHeaders(firstDayOfWeek, weekends) {
+ let headers = [];
+ let dayOfWeek = firstDayOfWeek;
+
+ for (let i = 0; i < DAYS_IN_A_WEEK; i++) {
+ headers.push({
+ content: dayOfWeek % DAYS_IN_A_WEEK,
+ classNames: weekends.includes(dayOfWeek % DAYS_IN_A_WEEK) ? ["weekend"] : []
+ });
+ dayOfWeek++;
+ }
+ return headers;
+ },
+
+ /**
+ * Get the first day on a calendar month
+ * @param {Date} dateObj
+ * @param {Number} firstDayOfWeek
+ * @return {Date}
+ */
+ _getFirstCalendarDate(dateObj, firstDayOfWeek) {
+ const daysOffset = 1 - DAYS_IN_A_WEEK;
+ let firstDayOfMonth = this._newUTCDate(dateObj.getUTCFullYear(), dateObj.getUTCMonth());
+ let dayOfWeek = firstDayOfMonth.getUTCDay();
+
+ return this._newUTCDate(
+ firstDayOfMonth.getUTCFullYear(),
+ firstDayOfMonth.getUTCMonth(),
+ // When first calendar date is the same as first day of the week, add
+ // another row on top of it.
+ firstDayOfWeek == dayOfWeek ? daysOffset : (firstDayOfWeek - dayOfWeek + daysOffset) % DAYS_IN_A_WEEK);
+ },
+
+ /**
+ * Helper function for creating UTC dates
+ * @param {...[Number]} parts
+ * @return {Date}
+ */
+ _newUTCDate(...parts) {
+ return new Date(new Date(0).setUTCFullYear(...parts));
+ },
+ };
+}
diff --git a/toolkit/content/widgets/datepicker.js b/toolkit/content/widgets/datepicker.js
new file mode 100644
index 000000000..0e9c9a6e6
--- /dev/null
+++ b/toolkit/content/widgets/datepicker.js
@@ -0,0 +1,376 @@
+/* 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/. */
+
+"use strict";
+
+function DatePicker(context) {
+ this.context = context;
+ this._attachEventListeners();
+}
+
+{
+ const CAL_VIEW_SIZE = 42;
+
+ DatePicker.prototype = {
+ /**
+ * Initializes the date picker. Set the default states and properties.
+ * @param {Object} props
+ * {
+ * {Number} year [optional]
+ * {Number} month [optional]
+ * {Number} date [optional]
+ * {Number} min
+ * {Number} max
+ * {Number} step
+ * {Number} stepBase
+ * {Number} firstDayOfWeek
+ * {Array<Number>} weekends
+ * {Array<String>} monthStrings
+ * {Array<String>} weekdayStrings
+ * {String} locale [optional]: User preferred locale
+ * }
+ */
+ init(props = {}) {
+ this.props = props;
+ this._setDefaultState();
+ this._createComponents();
+ this._update();
+ document.dispatchEvent(new CustomEvent("PickerReady"));
+ },
+
+ /*
+ * Set initial date picker states.
+ */
+ _setDefaultState() {
+ const { year, month, day, min, max, step, stepBase, firstDayOfWeek, weekends,
+ monthStrings, weekdayStrings, locale } = this.props;
+ const dateKeeper = new DateKeeper({
+ year, month, day, min, max, step, stepBase, firstDayOfWeek, weekends,
+ calViewSize: CAL_VIEW_SIZE
+ });
+
+ this.state = {
+ dateKeeper,
+ locale,
+ isMonthPickerVisible: false,
+ getDayString: day => day ? new Intl.NumberFormat(locale).format(day) : "",
+ getWeekHeaderString: weekday => weekdayStrings[weekday],
+ getMonthString: month => monthStrings[month],
+ setSelection: date => {
+ dateKeeper.setSelection({
+ year: date.getUTCFullYear(),
+ month: date.getUTCMonth(),
+ day: date.getUTCDate(),
+ });
+ this._update();
+ this._dispatchState();
+ this._closePopup();
+ },
+ setYear: year => {
+ dateKeeper.setYear(year);
+ dateKeeper.setSelection({
+ year,
+ month: dateKeeper.selection.month,
+ day: dateKeeper.selection.day,
+ });
+ this._update();
+ this._dispatchState();
+ },
+ setMonth: month => {
+ dateKeeper.setMonth(month);
+ dateKeeper.setSelection({
+ year: dateKeeper.selection.year,
+ month,
+ day: dateKeeper.selection.day,
+ });
+ this._update();
+ this._dispatchState();
+ },
+ toggleMonthPicker: () => {
+ this.state.isMonthPickerVisible = !this.state.isMonthPickerVisible;
+ this._update();
+ }
+ };
+ },
+
+ /**
+ * Initalize the date picker components.
+ */
+ _createComponents() {
+ this.components = {
+ calendar: new Calendar({
+ calViewSize: CAL_VIEW_SIZE,
+ locale: this.state.locale,
+ setSelection: this.state.setSelection,
+ getDayString: this.state.getDayString,
+ getWeekHeaderString: this.state.getWeekHeaderString
+ }, {
+ weekHeader: this.context.weekHeader,
+ daysView: this.context.daysView
+ }),
+ monthYear: new MonthYear({
+ setYear: this.state.setYear,
+ setMonth: this.state.setMonth,
+ getMonthString: this.state.getMonthString,
+ locale: this.state.locale
+ }, {
+ monthYear: this.context.monthYear,
+ monthYearView: this.context.monthYearView
+ })
+ };
+ },
+
+ /**
+ * Update date picker and its components.
+ */
+ _update(options = {}) {
+ const { dateKeeper, isMonthPickerVisible } = this.state;
+
+ if (isMonthPickerVisible) {
+ this.state.months = dateKeeper.getMonths();
+ this.state.years = dateKeeper.getYears();
+ } else {
+ this.state.days = dateKeeper.getDays();
+ }
+
+ this.components.monthYear.setProps({
+ isVisible: isMonthPickerVisible,
+ dateObj: dateKeeper.state.dateObj,
+ months: this.state.months,
+ years: this.state.years,
+ toggleMonthPicker: this.state.toggleMonthPicker,
+ noSmoothScroll: options.noSmoothScroll
+ });
+ this.components.calendar.setProps({
+ isVisible: !isMonthPickerVisible,
+ days: this.state.days,
+ weekHeaders: dateKeeper.state.weekHeaders
+ });
+
+ isMonthPickerVisible ?
+ this.context.monthYearView.classList.remove("hidden") :
+ this.context.monthYearView.classList.add("hidden");
+ },
+
+ /**
+ * Use postMessage to close the picker.
+ */
+ _closePopup() {
+ window.postMessage({
+ name: "ClosePopup"
+ }, "*");
+ },
+
+ /**
+ * Use postMessage to pass the state of picker to the panel.
+ */
+ _dispatchState() {
+ const { year, month, day } = this.state.dateKeeper.selection;
+ // The panel is listening to window for postMessage event, so we
+ // do postMessage to itself to send data to input boxes.
+ window.postMessage({
+ name: "PickerPopupChanged",
+ detail: {
+ year,
+ month,
+ day,
+ }
+ }, "*");
+ },
+
+ /**
+ * Attach event listeners
+ */
+ _attachEventListeners() {
+ window.addEventListener("message", this);
+ document.addEventListener("mouseup", this, { passive: true });
+ document.addEventListener("mousedown", this);
+ },
+
+ /**
+ * Handle events.
+ *
+ * @param {Event} event
+ */
+ handleEvent(event) {
+ switch (event.type) {
+ case "message": {
+ this.handleMessage(event);
+ break;
+ }
+ case "mousedown": {
+ // Use preventDefault to keep focus on input boxes
+ event.preventDefault();
+ event.target.setCapture();
+
+ if (event.target == this.context.buttonLeft) {
+ event.target.classList.add("active");
+ this.state.dateKeeper.setMonthByOffset(-1);
+ this._update();
+ } else if (event.target == this.context.buttonRight) {
+ event.target.classList.add("active");
+ this.state.dateKeeper.setMonthByOffset(1);
+ this._update();
+ }
+ break;
+ }
+ case "mouseup": {
+ if (event.target == this.context.buttonLeft || event.target == this.context.buttonRight) {
+ event.target.classList.remove("active");
+ }
+
+ }
+ }
+ },
+
+ /**
+ * Handle postMessage events.
+ *
+ * @param {Event} event
+ */
+ handleMessage(event) {
+ switch (event.data.name) {
+ case "PickerSetValue": {
+ this.set(event.data.detail);
+ break;
+ }
+ case "PickerInit": {
+ this.init(event.data.detail);
+ break;
+ }
+ }
+ },
+
+ /**
+ * Set the date state and update the components with the new state.
+ *
+ * @param {Object} dateState
+ * {
+ * {Number} year [optional]
+ * {Number} month [optional]
+ * {Number} date [optional]
+ * }
+ */
+ set({ year, month, day }) {
+ const { dateKeeper } = this.state;
+
+ dateKeeper.setCalendarMonth({
+ year, month
+ });
+ dateKeeper.setSelection({
+ year, month, day
+ });
+ this._update({ noSmoothScroll: true });
+ }
+ };
+
+ /**
+ * MonthYear is a component that handles the month & year spinners
+ *
+ * @param {Object} options
+ * {
+ * {String} locale
+ * {Function} setYear
+ * {Function} setMonth
+ * {Function} getMonthString
+ * }
+ * @param {DOMElement} context
+ */
+ function MonthYear(options, context) {
+ const spinnerSize = 5;
+ const yearFormat = new Intl.DateTimeFormat(options.locale, { year: "numeric",
+ timeZone: "UTC" }).format;
+ const dateFormat = new Intl.DateTimeFormat(options.locale, { year: "numeric",
+ month: "long",
+ timeZone: "UTC" }).format;
+ this.context = context;
+ this.state = { dateFormat };
+ this.props = {};
+ this.components = {
+ month: new Spinner({
+ setValue: month => {
+ this.state.isMonthSet = true;
+ options.setMonth(month);
+ },
+ getDisplayString: options.getMonthString,
+ viewportSize: spinnerSize
+ }, context.monthYearView),
+ year: new Spinner({
+ setValue: year => {
+ this.state.isYearSet = true;
+ options.setYear(year);
+ },
+ getDisplayString: year => yearFormat(new Date(new Date(0).setUTCFullYear(year))),
+ viewportSize: spinnerSize
+ }, context.monthYearView)
+ };
+
+ this._attachEventListeners();
+ }
+
+ MonthYear.prototype = {
+
+ /**
+ * Set new properties and pass them to components
+ *
+ * @param {Object} props
+ * {
+ * {Boolean} isVisible
+ * {Date} dateObj
+ * {Array<Object>} months
+ * {Array<Object>} years
+ * {Function} toggleMonthPicker
+ * }
+ */
+ setProps(props) {
+ this.context.monthYear.textContent = this.state.dateFormat(props.dateObj);
+
+ if (props.isVisible) {
+ this.context.monthYear.classList.add("active");
+ this.components.month.setState({
+ value: props.dateObj.getUTCMonth(),
+ items: props.months,
+ isInfiniteScroll: true,
+ isValueSet: this.state.isMonthSet,
+ smoothScroll: !(this.state.firstOpened || props.noSmoothScroll)
+ });
+ this.components.year.setState({
+ value: props.dateObj.getUTCFullYear(),
+ items: props.years,
+ isInfiniteScroll: false,
+ isValueSet: this.state.isYearSet,
+ smoothScroll: !(this.state.firstOpened || props.noSmoothScroll)
+ });
+ this.state.firstOpened = false;
+ } else {
+ this.context.monthYear.classList.remove("active");
+ this.state.isMonthSet = false;
+ this.state.isYearSet = false;
+ this.state.firstOpened = true;
+ }
+
+ this.props = Object.assign(this.props, props);
+ },
+
+ /**
+ * Handle events
+ * @param {DOMEvent} event
+ */
+ handleEvent(event) {
+ switch (event.type) {
+ case "click": {
+ this.props.toggleMonthPicker();
+ break;
+ }
+ }
+ },
+
+ /**
+ * Attach event listener to monthYear button
+ */
+ _attachEventListeners() {
+ this.context.monthYear.addEventListener("click", this);
+ }
+ };
+}
diff --git a/toolkit/content/widgets/datetimebox.css b/toolkit/content/widgets/datetimebox.css
index 4a9593a69..ce638078f 100644
--- a/toolkit/content/widgets/datetimebox.css
+++ b/toolkit/content/widgets/datetimebox.css
@@ -8,9 +8,17 @@
.datetime-input-box-wrapper {
-moz-appearance: none;
display: inline-flex;
+ flex: 1;
cursor: default;
background-color: inherit;
color: inherit;
+ min-width: 0;
+ justify-content: space-between;
+}
+
+.datetime-input-edit-wrapper {
+ overflow: hidden;
+ white-space: nowrap;
}
.datetime-input {
@@ -20,6 +28,8 @@
border: 0;
margin: 0;
ime-mode: disabled;
+ cursor: default;
+ -moz-user-select: none;
}
.datetime-separator {
@@ -41,5 +51,5 @@
height: 12px;
width: 12px;
align-self: center;
- justify-content: flex-end;
+ flex: none;
}
diff --git a/toolkit/content/widgets/datetimebox.xml b/toolkit/content/widgets/datetimebox.xml
index 05591e65a..94574038a 100644
--- a/toolkit/content/widgets/datetimebox.xml
+++ b/toolkit/content/widgets/datetimebox.xml
@@ -4,12 +4,466 @@
- 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/. -->
+<!DOCTYPE bindings [
+<!ENTITY % datetimeboxDTD SYSTEM "chrome://global/locale/datetimebox.dtd">
+%datetimeboxDTD;
+]>
+
+<!--
+TODO
+Bug 1446342:
+Input type="date" not working if the other form elements has name="document"
+
+Any alternative solution:
+document === window.document
+document === this.ownerDocument
+-->
+
<bindings id="datetimeboxBindings"
xmlns="http://www.mozilla.org/xbl"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:xbl="http://www.mozilla.org/xbl">
+ <binding id="date-input"
+ extends="chrome://global/content/bindings/datetimebox.xml#datetime-input-base">
+ <resources>
+ <stylesheet src="chrome://global/content/textbox.css"/>
+ <stylesheet src="chrome://global/skin/textbox.css"/>
+ <stylesheet src="chrome://global/content/bindings/datetimebox.css"/>
+ </resources>
+
+ <implementation>
+ <constructor>
+ <![CDATA[
+ /* eslint-disable no-multi-spaces */
+ this.mYearPlaceHolder = ]]>"&date.year.placeholder;"<![CDATA[;
+ this.mMonthPlaceHolder = ]]>"&date.month.placeholder;"<![CDATA[;
+ this.mDayPlaceHolder = ]]>"&date.day.placeholder;"<![CDATA[;
+ this.mSeparatorText = "/";
+ /* eslint-enable no-multi-spaces */
+
+ this.mMinMonth = 1;
+ this.mMaxMonth = 12;
+ this.mMinDay = 1;
+ this.mMaxDay = 31;
+ this.mMinYear = 1;
+ // Maximum year limited by ECMAScript date object range, year <= 275760.
+ this.mMaxYear = 275760;
+ this.mMonthDayLength = 2;
+ this.mYearLength = 4;
+ this.mMonthPageUpDownInterval = 3;
+ this.mDayPageUpDownInterval = 7;
+ this.mYearPageUpDownInterval = 10;
+
+ // Default to en-US, month-day-year order.
+ this.mMonthField =
+ window.document.getAnonymousElementByAttribute(this, "anonid", "input-one");
+ this.mDayField =
+ window.document.getAnonymousElementByAttribute(this, "anonid", "input-two");
+ this.mYearField =
+ window.document.getAnonymousElementByAttribute(this, "anonid", "input-three");
+ this.mYearField.size = this.mYearLength;
+ this.mYearField.maxLength = this.mMaxYear.toString().length;
+
+ this.mMonthField.placeholder = this.mMonthPlaceHolder;
+ this.mDayField.placeholder = this.mDayPlaceHolder;
+ this.mYearField.placeholder = this.mYearPlaceHolder;
+
+ this.mMonthField.setAttribute("min", this.mMinMonth);
+ this.mMonthField.setAttribute("max", this.mMaxMonth);
+ this.mMonthField.setAttribute("pginterval",
+ this.mMonthPageUpDownInterval);
+ this.mDayField.setAttribute("min", this.mMinDay);
+ this.mDayField.setAttribute("max", this.mMaxDay);
+ this.mDayField.setAttribute("pginterval", this.mDayPageUpDownInterval);
+ this.mYearField.setAttribute("min", this.mMinYear);
+ this.mYearField.setAttribute("max", this.mMaxYear);
+ this.mYearField.setAttribute("pginterval",
+ this.mYearPageUpDownInterval);
+
+ this.mDaySeparator =
+ window.document.getAnonymousElementByAttribute(this, "anonid", "sep-first");
+ this.mDaySeparator.textContent = this.mSeparatorText;
+ this.mYearSeparator =
+ window.document.getAnonymousElementByAttribute(this, "anonid", "sep-second");
+ this.mYearSeparator.textContent = this.mSeparatorText;
+
+ if (this.mInputElement.value) {
+ this.setFieldsFromInputValue();
+ }
+ this.updateResetButtonVisibility();
+ ]]>
+ </constructor>
+
+ <method name="clearInputFields">
+ <parameter name="aFromInputElement"/>
+ <body>
+ <![CDATA[
+ this.log("clearInputFields");
+
+ if (this.isDisabled() || this.isReadonly()) {
+ return;
+ }
+
+ if (this.mMonthField && !this.mMonthField.disabled &&
+ !this.mMonthField.readOnly) {
+ this.mMonthField.value = "";
+ this.mMonthField.setAttribute("typeBuffer", "");
+ }
+
+ if (this.mDayField && !this.mDayField.disabled &&
+ !this.mDayField.readOnly) {
+ this.mDayField.value = "";
+ this.mDayField.setAttribute("typeBuffer", "");
+ }
+
+ if (this.mYearField && !this.mYearField.disabled &&
+ !this.mYearField.readOnly) {
+ this.mYearField.value = "";
+ this.mYearField.setAttribute("typeBuffer", "");
+ }
+
+ if (!aFromInputElement && this.mInputElement.value) {
+ this.mInputElement.setUserInput("");
+ }
+
+ this.updateResetButtonVisibility();
+ ]]>
+ </body>
+ </method>
+
+ <method name="setFieldsFromInputValue">
+ <body>
+ <![CDATA[
+ let value = this.mInputElement.value;
+ if (!value) {
+ this.clearInputFields(true);
+ return;
+ }
+
+ this.log("setFieldsFromInputValue: " + value);
+ let [year, month, day] = value.split("-");
+
+ this.setFieldValue(this.mYearField, year);
+ this.setFieldValue(this.mMonthField, month);
+ this.setFieldValue(this.mDayField, day);
+
+ this.notifyPicker();
+ ]]>
+ </body>
+ </method>
+
+ <method name="getDaysInMonth">
+ <parameter name="aMonth"/>
+ <parameter name="aYear"/>
+ <body>
+ <![CDATA[
+ // Javascript's month is 0-based, so this means last day of the
+ // previous month.
+ return new Date(aYear, aMonth, 0).getDate();
+ ]]>
+ </body>
+ </method>
+
+ <method name="isFieldInvalid">
+ <parameter name="aField"/>
+ <body>
+ <![CDATA[
+ if (this.isEmpty(aField.value)) {
+ return true;
+ }
+
+ let min = Number(aField.getAttribute("min"));
+ let max = Number(aField.getAttribute("max"));
+
+ if (Number(aField.value) < min || Number(aField.value) > max) {
+ return true;
+ }
+
+ return false;
+ ]]>
+ </body>
+ </method>
+
+ <method name="setInputValueFromFields">
+ <body>
+ <![CDATA[
+ if (!this.isAnyValueAvailable(false) && this.mInputElement.value) {
+ // Values in the input box was cleared, clear the input element's
+ // value if not empty.
+ this.mInputElement.setUserInput("");
+ return;
+ }
+
+ if (this.isFieldInvalid(this.mYearField) ||
+ this.isFieldInvalid(this.mMonthField) ||
+ this.isFieldInvalid(this.mDayField)) {
+ // We still need to notify picker in case any of the field has
+ // changed. If we can set input element value, then notifyPicker
+ // will be called in setFieldsFromInputValue().
+ this.notifyPicker();
+ return;
+ }
+
+ let year = this.mYearField.value;
+ let month = this.mMonthField.value;
+ let day = this.mDayField.value;
+
+ if (day > this.getDaysInMonth(month, year)) {
+ // Don't set invalid date, otherwise input element's value will be
+ // set to empty.
+ return;
+ }
+
+ let date = [year, month, day].join("-");
+
+ if (date == this.mInputElement.value) {
+ return;
+ }
+
+ this.log("setInputValueFromFields: " + date);
+ this.mInputElement.setUserInput(date);
+ ]]>
+ </body>
+ </method>
+
+ <method name="setFieldsFromPicker">
+ <parameter name="aValue"/>
+ <body>
+ <![CDATA[
+ let year = aValue.year;
+ let month = aValue.month;
+ let day = aValue.day;
+
+ if (!this.isEmpty(year)) {
+ this.setFieldValue(this.mYearField, year);
+ }
+
+ if (!this.isEmpty(month)) {
+ this.setFieldValue(this.mMonthField, month);
+ }
+
+ if (!this.isEmpty(day)) {
+ this.setFieldValue(this.mDayField, day);
+ }
+
+ // Update input element's .value if needed.
+ this.setInputValueFromFields();
+ ]]>
+ </body>
+ </method>
+
+ <method name="handleKeypress">
+ <parameter name="aEvent"/>
+ <body>
+ <![CDATA[
+ if (this.isDisabled() || this.isReadonly()) {
+ return;
+ }
+
+ let targetField = aEvent.originalTarget;
+ let key = aEvent.key;
+
+ if (targetField.classList.contains("numeric") && key.match(/[0-9]/)) {
+ let buffer = targetField.getAttribute("typeBuffer") || "";
+
+ buffer = buffer.concat(key);
+ this.setFieldValue(targetField, buffer);
+ targetField.select();
+
+ let n = Number(buffer);
+ let max = targetField.getAttribute("max");
+ if (buffer.length >= targetField.maxLength || n * 10 > max) {
+ buffer = "";
+ this.advanceToNextField();
+ }
+ targetField.setAttribute("typeBuffer", buffer);
+ }
+ ]]>
+ </body>
+ </method>
+
+ <method name="incrementFieldValue">
+ <parameter name="aTargetField"/>
+ <parameter name="aTimes"/>
+ <body>
+ <![CDATA[
+ let value;
+
+ // Use current date if field is empty.
+ if (this.isEmpty(aTargetField.value)) {
+ let now = new Date();
+
+ if (aTargetField == this.mYearField) {
+ value = now.getFullYear();
+ } else if (aTargetField == this.mMonthField) {
+ value = now.getMonth() + 1;
+ } else if (aTargetField == this.mDayField) {
+ value = now.getDate();
+ } else {
+ this.log("Field not supported in incrementFieldValue.");
+ return;
+ }
+ } else {
+ value = Number(aTargetField.value);
+ }
+
+ let min = Number(aTargetField.getAttribute("min"));
+ let max = Number(aTargetField.getAttribute("max"));
+
+ value += Number(aTimes);
+ if (value > max) {
+ value -= (max - min + 1);
+ } else if (value < min) {
+ value += (max - min + 1);
+ }
+ this.setFieldValue(aTargetField, value);
+ aTargetField.select();
+ ]]>
+ </body>
+ </method>
+
+ <method name="handleKeyboardNav">
+ <parameter name="aEvent"/>
+ <body>
+ <![CDATA[
+ if (this.isDisabled() || this.isReadonly()) {
+ return;
+ }
+
+ let targetField = aEvent.originalTarget;
+ let key = aEvent.key;
+
+ // Home/End key does nothing on year field.
+ if (targetField == this.mYearField && (key == "Home" ||
+ key == "End")) {
+ return;
+ }
+
+ switch (key) {
+ case "ArrowUp":
+ this.incrementFieldValue(targetField, 1);
+ break;
+ case "ArrowDown":
+ this.incrementFieldValue(targetField, -1);
+ break;
+ case "PageUp": {
+ let interval = targetField.getAttribute("pginterval");
+ this.incrementFieldValue(targetField, interval);
+ break;
+ }
+ case "PageDown": {
+ let interval = targetField.getAttribute("pginterval");
+ this.incrementFieldValue(targetField, 0 - interval);
+ break;
+ }
+ case "Home":
+ let min = targetField.getAttribute("min");
+ this.setFieldValue(targetField, min);
+ targetField.select();
+ break;
+ case "End":
+ let max = targetField.getAttribute("max");
+ this.setFieldValue(targetField, max);
+ targetField.select();
+ break;
+ }
+ this.setInputValueFromFields();
+ ]]>
+ </body>
+ </method>
+
+ <method name="getCurrentValue">
+ <body>
+ <![CDATA[
+ let year;
+ if (!this.isEmpty(this.mYearField.value)) {
+ year = Number(this.mYearField.value);
+ }
+
+ let month;
+ if (!this.isEmpty(this.mMonthField.value)) {
+ month = Number(this.mMonthField.value);
+ }
+
+ let day;
+ if (!this.isEmpty(this.mDayField.value)) {
+ day = Number(this.mDayField.value);
+ }
+
+ let date = { year, month, day };
+
+ this.log("getCurrentValue: " + JSON.stringify(date));
+ return date;
+ ]]>
+ </body>
+ </method>
+
+ <method name="setFieldValue">
+ <parameter name="aField"/>
+ <parameter name="aValue"/>
+ <body>
+ <![CDATA[
+ let value = Number(aValue);
+ if (isNaN(value)) {
+ this.log("NaN on setFieldValue!");
+ return;
+ }
+
+ if (aValue.length == aField.maxLength) {
+ let min = Number(aField.getAttribute("min"));
+ let max = Number(aField.getAttribute("max"));
+
+ if (aValue < min) {
+ value = min;
+ } else if (aValue > max) {
+ value = max;
+ }
+ }
+
+ if (aField == this.mMonthField ||
+ aField == this.mDayField) {
+ // prepend zero
+ if (value < 10) {
+ value = "0" + value;
+ }
+ } else {
+ // prepend zeroes
+ if (value < 10) {
+ value = "000" + value;
+ } else if (value < 100) {
+ value = "00" + value;
+ } else if (value < 1000) {
+ value = "0" + value;
+ }
+
+ if (value.toString().length > this.mYearLength &&
+ value.toString().length <= this.mMaxYear.toString().length) {
+ this.mYearField.size = value.toString().length;
+ }
+ }
+
+ aField.value = value;
+ this.updateResetButtonVisibility();
+ ]]>
+ </body>
+ </method>
+
+ <method name="isAnyValueAvailable">
+ <parameter name="aForPicker"/>
+ <body>
+ <![CDATA[
+ return !this.isEmpty(this.mMonthField.value) ||
+ !this.isEmpty(this.mDayField.value) ||
+ !this.isEmpty(this.mYearField.value);
+ ]]>
+ </body>
+ </method>
+
+ </implementation>
+ </binding>
+
<binding id="time-input"
extends="chrome://global/content/bindings/datetimebox.xml#datetime-input-base">
<resources>
@@ -45,13 +499,13 @@
this.mMinSecPageUpDownInterval = 10;
this.mHourField =
- document.getAnonymousElementByAttribute(this, "anonid", "input-one");
+ window.document.getAnonymousElementByAttribute(this, "anonid", "input-one");
this.mHourField.setAttribute("typeBuffer", "");
this.mMinuteField =
- document.getAnonymousElementByAttribute(this, "anonid", "input-two");
+ window.document.getAnonymousElementByAttribute(this, "anonid", "input-two");
this.mMinuteField.setAttribute("typeBuffer", "");
this.mDayPeriodField =
- document.getAnonymousElementByAttribute(this, "anonid", "input-three");
+ window.document.getAnonymousElementByAttribute(this, "anonid", "input-three");
this.mDayPeriodField.classList.remove("numeric");
this.mHourField.placeholder = this.mPlaceHolder;
@@ -64,10 +518,10 @@
this.mMinuteField.setAttribute("max", this.mMaxMinute);
this.mMinuteSeparator =
- document.getAnonymousElementByAttribute(this, "anonid", "sep-first");
+ window.document.getAnonymousElementByAttribute(this, "anonid", "sep-first");
this.mMinuteSeparator.textContent = this.mSeparatorText;
this.mSpaceSeparator =
- document.getAnonymousElementByAttribute(this, "anonid", "sep-second");
+ window.document.getAnonymousElementByAttribute(this, "anonid", "sep-second");
// space between time and am/pm field
this.mSpaceSeparator.textContent = " ";
@@ -79,6 +533,7 @@
if (this.mInputElement.value) {
this.setFieldsFromInputValue();
}
+ this.updateResetButtonVisibility();
]]>
</constructor>
@@ -138,7 +593,7 @@
}
this.log("setFieldsFromInputValue: " + value);
- let [hour, minute, second] = value.split(':');
+ let [hour, minute, second] = value.split(":");
this.setFieldValue(this.mHourField, hour);
this.setFieldValue(this.mMinuteField, minute);
@@ -204,6 +659,13 @@
<method name="setInputValueFromFields">
<body>
<![CDATA[
+ if (!this.isAnyValueAvailable(false) && this.mInputElement.value) {
+ // Values in the input box was cleared, clear the input element's
+ // value if not empty.
+ this.mInputElement.setUserInput("");
+ return;
+ }
+
if (this.isEmpty(this.mHourField.value) ||
this.isEmpty(this.mMinuteField.value) ||
(this.mDayPeriodField && this.isEmpty(this.mDayPeriodField.value)) ||
@@ -239,6 +701,10 @@
time += "." + this.mMillisecField.value;
}
+ if (time == this.mInputElement.value) {
+ return;
+ }
+
this.log("setInputValueFromFields: " + time);
this.mInputElement.setUserInput(time);
]]>
@@ -265,6 +731,9 @@
if (!this.isEmpty(minute)) {
this.setFieldValue(this.mMinuteField, minute);
}
+
+ // Update input element's .value if needed.
+ this.setInputValueFromFields();
]]>
</body>
</method>
@@ -282,21 +751,25 @@
if (this.mHourField && !this.mHourField.disabled &&
!this.mHourField.readOnly) {
this.mHourField.value = "";
+ this.mHourField.setAttribute("typeBuffer", "");
}
if (this.mMinuteField && !this.mMinuteField.disabled &&
!this.mMinuteField.readOnly) {
this.mMinuteField.value = "";
+ this.mMinuteField.setAttribute("typeBuffer", "");
}
if (this.mSecondField && !this.mSecondField.disabled &&
!this.mSecondField.readOnly) {
this.mSecondField.value = "";
+ this.mSecondField.setAttribute("typeBuffer", "");
}
if (this.mMillisecField && !this.mMillisecField.disabled &&
!this.mMillisecField.readOnly) {
this.mMillisecField.value = "";
+ this.mMillisecField.setAttribute("typeBuffer", "");
}
if (this.mDayPeriodField && !this.mDayPeriodField.disabled &&
@@ -304,9 +777,11 @@
this.mDayPeriodField.value = "";
}
- if (!aFromInputElement) {
+ if (!aFromInputElement && this.mInputElement.value) {
this.mInputElement.setUserInput("");
}
+
+ this.updateResetButtonVisibility();
]]>
</body>
</method>
@@ -376,6 +851,7 @@
this.mDayPeriodField.value == this.mAMIndicator ?
this.mPMIndicator : this.mAMIndicator;
this.mDayPeriodField.select();
+ this.updateResetButtonVisibility();
this.setInputValueFromFields();
return;
}
@@ -433,6 +909,7 @@
this.mDayPeriodField.value = this.mPMIndicator;
this.mDayPeriodField.select();
}
+ this.updateResetButtonVisibility();
return;
}
@@ -488,16 +965,30 @@
}
aField.value = value;
+ this.updateResetButtonVisibility();
]]>
</body>
</method>
- <method name="isValueAvailable">
+ <method name="isAnyValueAvailable">
+ <parameter name="aForPicker"/>
<body>
<![CDATA[
+ let available = !this.isEmpty(this.mHourField.value) ||
+ !this.isEmpty(this.mMinuteField.value);
+
+ if (available) {
+ return true;
+ }
+
// Picker only cares about hour:minute.
- return !this.isEmpty(this.mHourField.value) ||
- !this.isEmpty(this.mMinuteField.value);
+ if (aForPicker) {
+ return false;
+ }
+
+ return (this.mDayPeriodField && !this.isEmpty(this.mDayPeriodField.value)) ||
+ (this.mSecondField && !this.isEmpty(this.mSecondField.value)) ||
+ (this.mMillisecField && !this.isEmpty(this.mMillisecField.value));
]]>
</body>
</method>
@@ -546,7 +1037,8 @@
<content>
<html:div class="datetime-input-box-wrapper"
xbl:inherits="context,disabled,readonly">
- <html:span>
+ <html:span class="datetime-input-edit-wrapper"
+ anonid="edit-wrapper">
<html:input anonid="input-one"
class="textbox-input datetime-input numeric"
size="2" maxlength="2"
@@ -563,9 +1055,8 @@
xbl:inherits="disabled,readonly,tabindex"/>
</html:span>
- <html:button class="datetime-reset-button" anoid="reset-button"
- tabindex="-1" xbl:inherits="disabled"
- onclick="document.getBindingParent(this).clearInputFields(false);"/>
+ <html:button class="datetime-reset-button" anonid="reset-button"
+ tabindex="-1" xbl:inherits="disabled"/>
</html:div>
</content>
@@ -579,9 +1070,49 @@
this.mMax = this.mInputElement.max;
this.mStep = this.mInputElement.step;
this.mIsPickerOpen = false;
+
+ this.mResetButton =
+ window.document.getAnonymousElementByAttribute(this, "anonid", "reset-button");
+
+ this.EVENTS.forEach((eventName) => {
+ this.addEventListener(eventName, this, { mozSystemGroup: true });
+ });
+ // Handle keypress separately since we need to catch it on capturing.
+ this.addEventListener("keypress", this, {
+ capture: true,
+ mozSystemGroup: true
+ });
+ // This is to open the picker when input element is clicked (this
+ // includes padding area).
+ this.mInputElement.addEventListener("click", this,
+ { mozSystemGroup: true });
]]>
</constructor>
+ <destructor>
+ <![CDATA[
+ this.EVENTS.forEach((eventName) => {
+ this.removeEventListener(eventName, this, { mozSystemGroup: true });
+ });
+ this.removeEventListener("keypress", this, {
+ capture: true,
+ mozSystemGroup: true
+ });
+ this.mInputElement.removeEventListener("click", this,
+ { mozSystemGroup: true });
+
+ this.mInputElement = null;
+ ]]>
+ </destructor>
+
+ <property name="EVENTS" readonly="true">
+ <getter>
+ <![CDATA[
+ return ["focus", "blur", "copy", "cut", "paste", "mousedown"];
+ ]]>
+ </getter>
+ </property>
+
<method name="log">
<parameter name="aMsg"/>
<body>
@@ -593,11 +1124,23 @@
</body>
</method>
+ <method name="updateResetButtonVisibility">
+ <body>
+ <![CDATA[
+ if (this.isAnyValueAvailable(false)) {
+ this.mResetButton.style.visibility = "visible";
+ } else {
+ this.mResetButton.style.visibility = "hidden";
+ }
+ ]]>
+ </body>
+ </method>
+
<method name="focusInnerTextBox">
<body>
<![CDATA[
this.log("focusInnerTextBox");
- document.getAnonymousElementByAttribute(this, "anonid", "input-one").focus();
+ window.document.getAnonymousElementByAttribute(this, "anonid", "input-one").focus();
]]>
</body>
</method>
@@ -710,10 +1253,22 @@
</body>
</method>
+ <method name="getCurrentValue">
+ <body>
+ throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
+ </body>
+ </method>
+
+ <method name="isAnyValueAvailable">
+ <body>
+ throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
+ </body>
+ </method>
+
<method name="notifyPicker">
<body>
<![CDATA[
- if (this.mIsPickerOpen && this.isValueAvailable()) {
+ if (this.mIsPickerOpen && this.isAnyValueAvailable(true)) {
this.mInputElement.updateDateTimePicker(this.getCurrentValue());
}
]]>
@@ -736,72 +1291,153 @@
</body>
</method>
- </implementation>
-
- <handlers>
- <handler event="focus">
- <![CDATA[
- this.log("focus on: " + event.originalTarget);
+ <method name="handleEvent">
+ <parameter name="aEvent"/>
+ <body>
+ <![CDATA[
+ this.log("handleEvent: " + aEvent.type);
- let target = event.originalTarget;
- if (target.type == "text") {
- this.mLastFocusedField = target;
- target.select();
- }
- ]]>
- </handler>
+ switch (aEvent.type) {
+ case "keypress": {
+ this.onKeyPress(aEvent);
+ break;
+ }
+ case "click": {
+ this.onClick(aEvent);
+ break;
+ }
+ case "focus": {
+ this.onFocus(aEvent);
+ break;
+ }
+ case "blur": {
+ this.onBlur(aEvent);
+ break;
+ }
+ case "mousedown": {
+ if (aEvent.originalTarget == this.mResetButton) {
+ aEvent.preventDefault();
+ }
+ break;
+ }
+ case "copy":
+ case "cut":
+ case "paste": {
+ aEvent.preventDefault();
+ break;
+ }
+ default:
+ break;
+ }
+ ]]>
+ </body>
+ </method>
- <handler event="blur">
- <![CDATA[
- this.setInputValueFromFields();
- ]]>
- </handler>
+ <method name="onFocus">
+ <parameter name="aEvent"/>
+ <body>
+ <![CDATA[
+ this.log("onFocus originalTarget: " + aEvent.originalTarget);
- <handler event="click">
- <![CDATA[
- // XXX: .originalTarget is not expected.
- // When clicking on one of the inner text boxes, the .originalTarget is
- // a HTMLDivElement and when clicking on the reset button, it's a
- // HTMLButtonElement but it's not equal to our reset-button.
- this.log("click on: " + event.originalTarget);
- if (event.defaultPrevented || this.isDisabled() || this.isReadonly()) {
- return;
- }
+ let target = aEvent.originalTarget;
+ if ((target instanceof HTMLInputElement) && target.type == "text") {
+ this.mLastFocusedField = target;
+ target.select();
+ }
+ ]]>
+ </body>
+ </method>
- if (!(event.originalTarget instanceof HTMLButtonElement)) {
- this.mInputElement.openDateTimePicker(this.getCurrentValue());
- }
- ]]>
- </handler>
+ <method name="onBlur">
+ <parameter name="aEvent"/>
+ <body>
+ <![CDATA[
+ this.log("onBlur originalTarget: " + aEvent.originalTarget +
+ " target: " + aEvent.target);
- <handler event="keypress" phase="capturing">
- <![CDATA[
- let key = event.key;
- this.log("keypress: " + key);
+ let target = aEvent.originalTarget;
+ target.setAttribute("typeBuffer", "");
+ this.setInputValueFromFields();
+ ]]>
+ </body>
+ </method>
- if (key == "Backspace" || key == "Tab") {
- return;
- }
+ <method name="onKeyPress">
+ <parameter name="aEvent"/>
+ <body>
+ <![CDATA[
+ this.log("onKeyPress key: " + aEvent.key);
+
+ switch (aEvent.key) {
+ // Close picker on Enter, Escape or Space key.
+ case "Enter":
+ case "Escape":
+ case " ": {
+ if (this.mIsPickerOpen) {
+ this.mInputElement.closeDateTimePicker();
+ aEvent.preventDefault();
+ }
+ break;
+ }
+ case "Backspace": {
+ let targetField = aEvent.originalTarget;
+ targetField.value = "";
+ targetField.setAttribute("typeBuffer", "");
+ this.updateResetButtonVisibility();
+ this.setInputValueFromFields();
+ aEvent.preventDefault();
+ break;
+ }
+ case "ArrowRight":
+ case "ArrowLeft": {
+ this.advanceToNextField(aEvent.key == "ArrowRight" ? false : true);
+ aEvent.preventDefault();
+ break;
+ }
+ case "ArrowUp":
+ case "ArrowDown":
+ case "PageUp":
+ case "PageDown":
+ case "Home":
+ case "End": {
+ this.handleKeyboardNav(aEvent);
+ aEvent.preventDefault();
+ break;
+ }
+ default: {
+ // printable characters
+ if (aEvent.keyCode == 0 &&
+ !(aEvent.ctrlKey || aEvent.altKey || aEvent.metaKey)) {
+ this.handleKeypress(aEvent);
+ aEvent.preventDefault();
+ }
+ break;
+ }
+ }
+ ]]>
+ </body>
+ </method>
- if (key == "Enter" || key == " ") {
- // Close picker on Enter and Space.
- this.mInputElement.closeDateTimePicker();
- }
+ <method name="onClick">
+ <parameter name="aEvent"/>
+ <body>
+ <![CDATA[
+ this.log("onClick originalTarget: " + aEvent.originalTarget +
+ " target: " + aEvent.target);
- if (key == "ArrowUp" || key == "ArrowDown" ||
- key == "PageUp" || key == "PageDown" ||
- key == "Home" || key == "End") {
- this.handleKeyboardNav(event);
- } else if (key == "ArrowRight" || key == "ArrowLeft") {
- this.advanceToNextField((key == "ArrowRight" ? false : true));
- } else {
- this.handleKeypress(event);
- }
+ if (aEvent.defaultPrevented || this.isDisabled() || this.isReadonly()) {
+ return;
+ }
- event.preventDefault();
- ]]>
- </handler>
- </handlers>
+ if (aEvent.originalTarget == this.mResetButton) {
+ this.clearInputFields(false);
+ } else if (!this.mIsPickerOpen) {
+ this.mInputElement.openDateTimePicker(this.getCurrentValue());
+ }
+ ]]>
+ </body>
+ </method>
+ </implementation>
</binding>
</bindings>
diff --git a/toolkit/content/widgets/datetimepicker.xml b/toolkit/content/widgets/datetimepicker.xml
index 5f16f1ff0..1d6a5e772 100644
--- a/toolkit/content/widgets/datetimepicker.xml
+++ b/toolkit/content/widgets/datetimepicker.xml
@@ -999,13 +999,13 @@
<body>
<![CDATA[
var locale = Intl.DateTimeFormat().resolvedOptions().locale + "-u-ca-gregory";
- var dtfMonth = Intl.DateTimeFormat(locale, {month: "long"});
+ var dtfMonth = Intl.DateTimeFormat(locale, {month: "long", timeZone: "UTC"});
var dtfWeekday = Intl.DateTimeFormat(locale, {weekday: "narrow"});
var monthLabel = this.monthField.firstChild;
- var tempDate = new Date(2005, 0, 1);
+ var tempDate = new Date(Date.UTC(2005, 0, 1));
for (var month = 0; month < 12; month++) {
- tempDate.setMonth(month);
+ tempDate.setUTCMonth(month);
monthLabel.setAttribute("value", dtfMonth.format(tempDate));
monthLabel = monthLabel.nextSibling;
}
diff --git a/toolkit/content/widgets/datetimepopup.xml b/toolkit/content/widgets/datetimepopup.xml
index 327f45368..b4335e1ce 100644
--- a/toolkit/content/widgets/datetimepopup.xml
+++ b/toolkit/content/widgets/datetimepopup.xml
@@ -11,17 +11,31 @@
xmlns:xbl="http://www.mozilla.org/xbl">
<binding id="datetime-popup"
extends="chrome://global/content/bindings/popup.xml#arrowpanel">
+ <resources>
+ <stylesheet src="chrome://global/skin/datetimepopup.css"/>
+ </resources>
<implementation>
<field name="dateTimePopupFrame">
this.querySelector("#dateTimePopupFrame");
</field>
<field name="TIME_PICKER_WIDTH" readonly="true">"12em"</field>
<field name="TIME_PICKER_HEIGHT" readonly="true">"21em"</field>
- <method name="loadPicker">
+ <field name="DATE_PICKER_WIDTH" readonly="true">"23.1em"</field>
+ <field name="DATE_PICKER_HEIGHT" readonly="true">"20.7em"</field>
+ <constructor><![CDATA[
+ this.l10n = {};
+ const mozIntl = Components.classes["@mozilla.org/mozintl;1"]
+ .getService(Components.interfaces.mozIMozIntl);
+ mozIntl.addGetCalendarInfo(l10n);
+ mozIntl.addGetDisplayNames(l10n);
+ // Notify DateTimePickerHelper.jsm that binding is ready.
+ this.dispatchEvent(new CustomEvent("DateTimePickerBindingReady"));
+ ]]></constructor>
+ <method name="openPicker">
<parameter name="type"/>
+ <parameter name="anchor"/>
<parameter name="detail"/>
<body><![CDATA[
- this.hidden = false;
this.type = type;
this.pickerState = {};
// TODO: Resize picker according to content zoom level
@@ -35,18 +49,28 @@
this.dateTimePopupFrame.style.height = this.TIME_PICKER_HEIGHT;
break;
}
+ case "date": {
+ this.detail = detail;
+ this.dateTimePopupFrame.addEventListener("load", this, true);
+ this.dateTimePopupFrame.setAttribute("src", "chrome://global/content/datepicker.xhtml");
+ this.dateTimePopupFrame.style.width = this.DATE_PICKER_WIDTH;
+ this.dateTimePopupFrame.style.height = this.DATE_PICKER_HEIGHT;
+ break;
+ }
}
+ this.hidden = false;
+ this.openPopup(anchor, "after_start", 0, 0);
]]></body>
</method>
<method name="closePicker">
<body><![CDATA[
- this.hidden = true;
this.setInputBoxValue(true);
this.pickerState = {};
this.type = undefined;
this.dateTimePopupFrame.removeEventListener("load", this, true);
- this.dateTimePopupFrame.contentDocument.removeEventListener("TimePickerPopupChanged", this, false);
+ this.dateTimePopupFrame.contentDocument.removeEventListener("message", this, false);
this.dateTimePopupFrame.setAttribute("src", "");
+ this.hidden = true;
]]></body>
</method>
<method name="setPopupValue">
@@ -55,25 +79,39 @@
switch (this.type) {
case "time": {
this.postMessageToPicker({
- name: "TimePickerSetValue",
+ name: "PickerSetValue",
detail: data.value
});
break;
}
+ case "date": {
+ const { year, month, day } = data.value;
+ this.postMessageToPicker({
+ name: "PickerSetValue",
+ detail: {
+ year,
+ // Month value from input box starts from 1 instead of 0
+ month: month == undefined ? undefined : month - 1,
+ day
+ }
+ });
+ break;
+ }
}
]]></body>
</method>
<method name="initPicker">
<parameter name="detail"/>
<body><![CDATA[
+ const locale = Components.classes["@mozilla.org/chrome/chrome-registry;1"].getService(Ci.nsIXULChromeRegistry).getSelectedLocale("global");
+
switch (this.type) {
case "time": {
const { hour, minute } = detail.value;
const format = detail.format || "12";
- const locale = Components.classes["@mozilla.org/chrome/chrome-registry;1"].getService(Ci.nsIXULChromeRegistry).getSelectedLocale("global");
this.postMessageToPicker({
- name: "TimePickerInit",
+ name: "PickerInit",
detail: {
hour,
minute,
@@ -86,6 +124,56 @@
});
break;
}
+ case "date": {
+ const { year, month, day } = detail.value;
+ const { firstDayOfWeek, weekends } =
+ this.getCalendarInfo(locale);
+ const monthStrings = this.getDisplayNames(
+ locale, [
+ "dates/gregorian/months/january",
+ "dates/gregorian/months/february",
+ "dates/gregorian/months/march",
+ "dates/gregorian/months/april",
+ "dates/gregorian/months/may",
+ "dates/gregorian/months/june",
+ "dates/gregorian/months/july",
+ "dates/gregorian/months/august",
+ "dates/gregorian/months/september",
+ "dates/gregorian/months/october",
+ "dates/gregorian/months/november",
+ "dates/gregorian/months/december",
+ ], "short");
+ const weekdayStrings = this.getDisplayNames(
+ locale, [
+ "dates/gregorian/weekdays/sunday",
+ "dates/gregorian/weekdays/monday",
+ "dates/gregorian/weekdays/tuesday",
+ "dates/gregorian/weekdays/wednesday",
+ "dates/gregorian/weekdays/thursday",
+ "dates/gregorian/weekdays/friday",
+ "dates/gregorian/weekdays/saturday",
+ ], "short");
+
+ this.postMessageToPicker({
+ name: "PickerInit",
+ detail: {
+ year,
+ // Month value from input box starts from 1 instead of 0
+ month: month == undefined ? undefined : month - 1,
+ day,
+ firstDayOfWeek,
+ weekends,
+ monthStrings,
+ weekdayStrings,
+ locale,
+ min: detail.min,
+ max: detail.max,
+ step: detail.step,
+ stepBase: detail.stepBase,
+ }
+ });
+ break;
+ }
}
]]></body>
</method>
@@ -109,6 +197,10 @@
}
break;
}
+ case "date": {
+ this.sendPickerValueChanged(this.pickerState);
+ break;
+ }
}
]]></body>
</method>
@@ -125,9 +217,60 @@
}));
break;
}
+ case "date": {
+ this.dispatchEvent(new CustomEvent("DateTimePickerValueChanged", {
+ detail: {
+ year: value.year,
+ // Month value from input box starts from 1 instead of 0
+ month: value.month == undefined ? undefined : value.month + 1,
+ day: value.day
+ }
+ }));
+ break;
+ }
}
]]></body>
</method>
+ <method name="getCalendarInfo">
+ <parameter name="locale"/>
+ <body><![CDATA[
+ const calendarInfo = this.l10n.getCalendarInfo(locale);
+
+ // Day of week from calendarInfo starts from 1 as Sunday to 7 as Saturday,
+ // so they need to be mapped to JavaScript convention with 0 as Sunday
+ // and 6 as Saturday
+ let firstDayOfWeek = calendarInfo.firstDayOfWeek - 1,
+ weekendStart = calendarInfo.weekendStart - 1,
+ weekendEnd = calendarInfo.weekendEnd - 1;
+
+ let weekends = [];
+
+ // Make sure weekendEnd is greater than weekendStart
+ if (weekendEnd < weekendStart) {
+ weekendEnd += 7;
+ }
+
+ // We get the weekends by incrementing weekendStart up to weekendEnd.
+ // If the start and end is the same day, then weekends only has one day.
+ for (let day = weekendStart; day <= weekendEnd; day++) {
+ weekends.push(day % 7);
+ }
+
+ return {
+ firstDayOfWeek,
+ weekends
+ }
+ ]]></body>
+ </method>
+ <method name="getDisplayNames">
+ <parameter name="locale"/>
+ <parameter name="keys"/>
+ <parameter name="style"/>
+ <body><![CDATA[
+ const displayNames = this.l10n.getDisplayNames(locale, {keys, style});
+ return keys.map(key => displayNames.values[key]);
+ ]]></body>
+ </method>
<method name="handleEvent">
<parameter name="aEvent"/>
<body><![CDATA[
@@ -152,11 +295,16 @@
}
switch (aEvent.data.name) {
- case "TimePickerPopupChanged": {
+ case "PickerPopupChanged": {
this.pickerState = aEvent.data.detail;
this.setInputBoxValue();
break;
}
+ case "ClosePopup": {
+ this.hidePopup();
+ this.closePicker();
+ break;
+ }
}
]]></body>
</method>
@@ -170,12 +318,5 @@
</method>
</implementation>
- <handlers>
- <handler event="popuphiding">
- <![CDATA[
- this.closePicker();
- ]]>
- </handler>
- </handlers>
</binding>
</bindings>
diff --git a/toolkit/content/widgets/findbar.xml b/toolkit/content/widgets/findbar.xml
index f90d41227..b92fb1d05 100644
--- a/toolkit/content/widgets/findbar.xml
+++ b/toolkit/content/widgets/findbar.xml
@@ -162,21 +162,29 @@
<content hidden="true">
<xul:hbox anonid="findbar-container" class="findbar-container" flex="1" align="center">
<xul:hbox anonid="findbar-textbox-wrapper" align="stretch">
+ <xul:toolbarbutton anonid="find-closebutton"
+ class="findbar-closebutton close-icon"
+ tooltiptext="&findCloseButton.tooltip;"
+ oncommand="close();"/>
<xul:textbox anonid="findbar-textbox"
class="findbar-textbox findbar-find-fast"
xbl:inherits="flash"/>
- <xul:toolbarbutton anonid="find-previous"
- class="findbar-find-previous tabbable"
- tooltiptext="&previous.tooltip;"
- oncommand="onFindAgainCommand(true);"
- disabled="true"
- xbl:inherits="accesskey=findpreviousaccesskey"/>
- <xul:toolbarbutton anonid="find-next"
+ <xul:toolbarbutton anonid="find-next"
class="findbar-find-next tabbable"
+ label="&next.label;"
+ accesskey="&next.accesskey;"
tooltiptext="&next.tooltip;"
oncommand="onFindAgainCommand(false);"
disabled="true"
xbl:inherits="accesskey=findnextaccesskey"/>
+ <xul:toolbarbutton anonid="find-previous"
+ class="findbar-find-previous tabbable"
+ label="&previous.label;"
+ accesskey="&previous.accesskey;"
+ tooltiptext="&previous.tooltip;"
+ oncommand="onFindAgainCommand(true);"
+ disabled="true"
+ xbl:inherits="accesskey=findpreviousaccesskey"/>
</xul:hbox>
<xul:toolbarbutton anonid="highlight"
class="findbar-highlight findbar-button tabbable"
@@ -186,22 +194,22 @@
oncommand="toggleHighlight(this.checked);"
type="checkbox"
xbl:inherits="accesskey=highlightaccesskey"/>
- <xul:toolbarbutton anonid="find-case-sensitive"
- class="findbar-case-sensitive findbar-button tabbable"
- label="&caseSensitive.label;"
- accesskey="&caseSensitive.accesskey;"
- tooltiptext="&caseSensitive.tooltiptext;"
- oncommand="_setCaseSensitivity(this.checked ? 1 : 0);"
- type="checkbox"
- xbl:inherits="accesskey=matchcaseaccesskey"/>
- <xul:toolbarbutton anonid="find-entire-word"
- class="findbar-entire-word findbar-button tabbable"
- label="&entireWord.label;"
- accesskey="&entireWord.accesskey;"
- tooltiptext="&entireWord.tooltiptext;"
- oncommand="toggleEntireWord(this.checked);"
- type="checkbox"
- xbl:inherits="accesskey=entirewordaccesskey"/>
+ <xul:checkbox anonid="find-case-sensitive"
+ class="findbar-case-sensitive findbar-button tabbable"
+ label="&caseSensitive.label;"
+ accesskey="&caseSensitive.accesskey;"
+ tooltiptext="&caseSensitive.tooltiptext;"
+ oncommand="_setCaseSensitivity(this.checked ? 1 : 0);"
+ type="checkbox"
+ xbl:inherits="accesskey=matchcaseaccesskey"/>
+ <xul:checkbox anonid="find-entire-word"
+ class="findbar-entire-word findbar-button tabbable"
+ label="&entireWord.label;"
+ accesskey="&entireWord.accesskey;"
+ tooltiptext="&entireWord.tooltiptext;"
+ oncommand="toggleEntireWord(this.checked);"
+ type="checkbox"
+ xbl:inherits="accesskey=entirewordaccesskey"/>
<xul:label anonid="match-case-status" class="findbar-find-fast"/>
<xul:label anonid="entire-word-status" class="findbar-find-fast"/>
<xul:label anonid="found-matches" class="findbar-find-fast found-matches" hidden="true"/>
@@ -212,10 +220,6 @@
<!-- Do not use value, first child is used because it provides a11y with text change events -->
</xul:description>
</xul:hbox>
- <xul:toolbarbutton anonid="find-closebutton"
- class="findbar-closebutton close-icon"
- tooltiptext="&findCloseButton.tooltip;"
- oncommand="close();"/>
</content>
<implementation implements="nsIMessageListener, nsIEditActionListener">
diff --git a/toolkit/content/widgets/menulist.xml b/toolkit/content/widgets/menulist.xml
index ccdf3bd26..96c011809 100644
--- a/toolkit/content/widgets/menulist.xml
+++ b/toolkit/content/widgets/menulist.xml
@@ -129,8 +129,22 @@
<property name="label" readonly="true" onget="return this.getAttribute('label');"/>
<property name="description" onset="this.setAttribute('description',val); return val;"
onget="return this.getAttribute('description');"/>
- <property name="editable" onset="this.setAttribute('editable',val); return val;"
- onget="return this.getAttribute('editable') == 'true';"/>
+
+ <property name="editable" onget="return this.getAttribute('editable') == 'true';">
+ <setter>
+ <![CDATA[
+ if (!val && this.editable) {
+ // If we were focused and transition from editable to not editable,
+ // focus the parent menulist so that the focus does not get stuck.
+ if (this.inputField == document.activeElement)
+ window.setTimeout(() => this.focus(), 0);
+ }
+
+ this.setAttribute("editable", val);
+ return val;
+ ]]>
+ </setter>
+ </property>
<property name="open" onset="this.menuBoxObject.openMenu(val);
return val;"
diff --git a/toolkit/content/widgets/spinner.js b/toolkit/content/widgets/spinner.js
index 208ab1931..4901320b5 100644
--- a/toolkit/content/widgets/spinner.js
+++ b/toolkit/content/widgets/spinner.js
@@ -98,7 +98,7 @@ function Spinner(props, context) {
setState(newState) {
const { spinner } = this.elements;
const { value, items } = this.state;
- const { value: newValue, items: newItems, isValueSet, isInvalid } = newState;
+ const { value: newValue, items: newItems, isValueSet, isInvalid, smoothScroll = true } = newState;
if (this._isArrayDiff(newItems, items)) {
this.state = Object.assign(this.state, newState);
@@ -106,23 +106,23 @@ function Spinner(props, context) {
this._scrollTo(newValue, true);
} else if (newValue != value) {
this.state = Object.assign(this.state, newState);
- this._smoothScrollTo(newValue);
- }
-
- if (isValueSet) {
- if (isInvalid) {
- this._removeSelection();
+ if (smoothScroll) {
+ this._smoothScrollTo(newValue, true);
} else {
- this._updateSelection();
+ this._scrollTo(newValue, true);
}
}
+
+ if (isValueSet && !isInvalid) {
+ this._updateSelection();
+ } else {
+ this._removeSelection();
+ }
},
/**
* Whenever scroll event is detected:
* - Update the index state
- * - If a smooth scroll has reached its destination, set [isScrolling] state
- * to false
* - If the value has changed, update the [value] state and call [setValue]
* - If infinite scrolling is on, reset the scrolling position if necessary
*/
@@ -135,14 +135,8 @@ function Spinner(props, context) {
const value = itemsView[this.state.index + viewportTopOffset].value;
- // Check if smooth scrolling has reached its destination.
- // This prevents input box jump when input box changes values.
- if (this.state.value == value && this.state.isScrolling) {
- this.state.isScrolling = false;
- }
-
- // Call setValue if value has changed, and is not smooth scrolling
- if (this.state.value != value && !this.state.isScrolling) {
+ // Call setValue if value has changed
+ if (this.state.value != value) {
this.state.value = value;
this.props.setValue(value);
}
@@ -266,11 +260,11 @@ function Spinner(props, context) {
* Attach event listeners to the spinner and buttons.
*/
_attachEventListeners() {
- const { spinner } = this.elements;
+ const { spinner, container } = this.elements;
spinner.addEventListener("scroll", this, { passive: true });
- document.addEventListener("mouseup", this, { passive: true });
- document.addEventListener("mousedown", this);
+ container.addEventListener("mouseup", this, { passive: true });
+ container.addEventListener("mousedown", this, { passive: true });
},
/**
@@ -288,9 +282,6 @@ function Spinner(props, context) {
break;
}
case "mousedown": {
- // Use preventDefault to keep focus on input boxes
- event.preventDefault();
- event.target.setCapture();
this.state.mouseState = {
down: true,
layerX: event.layerX,
@@ -300,11 +291,11 @@ function Spinner(props, context) {
// An "active" class is needed to simulate :active pseudo-class
// because element is not focused.
event.target.classList.add("active");
- this._smoothScrollToIndex(index + 1);
+ this._smoothScrollToIndex(index - 1);
}
if (event.target == down) {
event.target.classList.add("active");
- this._smoothScrollToIndex(index - 1);
+ this._smoothScrollToIndex(index + 1);
}
if (event.target.parentNode == spinner) {
// Listen to dragging events
@@ -444,10 +435,6 @@ function Spinner(props, context) {
_smoothScrollToIndex(index) {
const element = this.elements.spinner.children[index];
if (element) {
- // Set the isScrolling flag before smooth scrolling begins
- // and remove it when it has reached the destination.
- // This prevents input box jump when input box changes values
- this.state.isScrolling = true;
element.scrollIntoView({
behavior: "smooth", block: "start"
});
diff --git a/toolkit/content/widgets/timekeeper.js b/toolkit/content/widgets/timekeeper.js
index 2234c9e50..3b4e7eb0a 100644
--- a/toolkit/content/widgets/timekeeper.js
+++ b/toolkit/content/widgets/timekeeper.js
@@ -14,7 +14,7 @@
* {
* {Date} min
* {Date} max
- * {Number} stepInMs
+ * {Number} step
* {String} format: Either "12" or "24"
* }
*/
@@ -286,15 +286,15 @@ function TimeKeeper(props) {
* }
*/
_getSteps(startValue, endValue, minStep, formatter) {
- const { min, max, stepInMs } = this.props;
+ const { min, max, step } = this.props;
// The timeStep should be big enough so that there won't be
// duplications. Ex: minimum step for minute should be 60000ms,
// if smaller than that, next step might return the same minute.
- const timeStep = Math.max(minStep, stepInMs);
+ const timeStep = Math.max(minStep, step);
// Make sure the starting point and end point is not off step
let time = min.valueOf() + Math.ceil((startValue - min.valueOf()) / timeStep) * timeStep;
- let maxValue = min.valueOf() + Math.floor((max.valueOf() - min.valueOf()) / stepInMs) * stepInMs;
+ let maxValue = min.valueOf() + Math.floor((max.valueOf() - min.valueOf()) / step) * step;
let steps = [];
// Increment by timeStep until reaching the end of the range.
@@ -410,9 +410,9 @@ function TimeKeeper(props) {
* @return {Boolean}
*/
_isOffStep(time) {
- const { min, stepInMs } = this.props;
+ const { min, step } = this.props;
- return (time.valueOf() - min.valueOf()) % stepInMs != 0;
+ return (time.valueOf() - min.valueOf()) % step != 0;
}
};
}
diff --git a/toolkit/content/widgets/timepicker.js b/toolkit/content/widgets/timepicker.js
index f438e9ec6..1f0463fe4 100644
--- a/toolkit/content/widgets/timepicker.js
+++ b/toolkit/content/widgets/timepicker.js
@@ -13,8 +13,6 @@ function TimePicker(context) {
const debug = 0 ? console.log.bind(console, "[timepicker]") : function() {};
const DAY_PERIOD_IN_HOURS = 12,
- SECOND_IN_MS = 1000,
- MINUTE_IN_MS = 60000,
DAY_IN_MS = 86400000;
TimePicker.prototype = {
@@ -24,9 +22,9 @@ function TimePicker(context) {
* {
* {Number} hour [optional]: Hour in 24 hours format (0~23), default is current hour
* {Number} minute [optional]: Minute (0~59), default is current minute
- * {String} min [optional]: Minimum time, in 24 hours format. ex: "05:45"
- * {String} max [optional]: Maximum time, in 24 hours format. ex: "23:00"
- * {Number} step [optional]: Step size in minutes. Default is 60.
+ * {Number} min: Minimum time, in ms
+ * {Number} max: Maximum time, in ms
+ * {Number} step: Step size in ms
* {String} format [optional]: "12" for 12 hours, "24" for 24 hours format
* {String} locale [optional]: User preferred locale
* }
@@ -51,11 +49,10 @@ function TimePicker(context) {
let timerHour = hour == undefined ? now.getHours() : hour;
let timerMinute = minute == undefined ? now.getMinutes() : minute;
- // The spec defines 1 step == 1 second, need to convert to ms for timekeeper
let timeKeeper = new TimeKeeper({
- min: this._parseTimeString(min) || new Date(0),
- max: this._parseTimeString(max) || new Date(DAY_IN_MS - 1),
- stepInMs: step ? step * SECOND_IN_MS : MINUTE_IN_MS,
+ min: new Date(Number.isNaN(min) ? 0 : min),
+ max: new Date(Number.isNaN(max) ? DAY_IN_MS - 1 : max),
+ step,
format: format || "12"
});
timeKeeper.setState({ hour: timerHour, minute: timerMinute });
@@ -64,17 +61,6 @@ function TimePicker(context) {
},
/**
- * Convert a time string from DOM attribute to a date object.
- *
- * @param {String} timeString: (ex. "10:30", "23:55", "12:34:56.789")
- * @return {Date/Boolean} Date object or false if date is invalid.
- */
- _parseTimeString(timeString) {
- let time = new Date("1970-01-01T" + timeString + "Z");
- return time.toString() == "Invalid Date" ? false : time;
- },
-
- /**
* Initalize the spinner components.
*/
_createComponents() {
@@ -206,7 +192,7 @@ function TimePicker(context) {
// The panel is listening to window for postMessage event, so we
// do postMessage to itself to send data to input boxes.
window.postMessage({
- name: "TimePickerPopupChanged",
+ name: "PickerPopupChanged",
detail: {
hour,
minute,
@@ -218,6 +204,7 @@ function TimePicker(context) {
},
_attachEventListeners() {
window.addEventListener("message", this);
+ document.addEventListener("mousedown", this);
},
/**
@@ -231,6 +218,12 @@ function TimePicker(context) {
this.handleMessage(event);
break;
}
+ case "mousedown": {
+ // Use preventDefault to keep focus on input boxes
+ event.preventDefault();
+ event.target.setCapture();
+ break;
+ }
}
},
@@ -241,11 +234,11 @@ function TimePicker(context) {
*/
handleMessage(event) {
switch (event.data.name) {
- case "TimePickerSetValue": {
+ case "PickerSetValue": {
this.set(event.data.detail);
break;
}
- case "TimePickerInit": {
+ case "PickerInit": {
this.init(event.data.detail);
break;
}
diff --git a/toolkit/content/widgets/toolbar.xml b/toolkit/content/widgets/toolbar.xml
index 548504e24..55cef8244 100644
--- a/toolkit/content/widgets/toolbar.xml
+++ b/toolkit/content/widgets/toolbar.xml
@@ -30,7 +30,7 @@
</field>
<field name="externalToolbars">
- []
+ []
</field>
<!-- Set by customizeToolbar.js -->
@@ -49,18 +49,54 @@
<constructor>
<![CDATA[
+ this.toolbarInfoSeparators = ["|", "-"];
+ this.toolbarInfoLegacySeparator = ":";
// Look to see if there is a toolbarset.
this.toolbarset = this.firstChild;
- while (this.toolbarset && this.toolbarset.localName != "toolbarset")
- this.toolbarset = toolbarset.nextSibling;
+ while (this.toolbarset && this.toolbarset.localName != "toolbarset") {
+ this.toolbarset = this.toolbarset.nextSibling;
+ }
if (this.toolbarset) {
// Create each toolbar described by the toolbarset.
var index = 0;
- while (toolbarset.hasAttribute("toolbar"+(++index))) {
- var toolbarInfo = toolbarset.getAttribute("toolbar"+index);
- var infoSplit = toolbarInfo.split(":");
- this.appendCustomToolbar(infoSplit[0], infoSplit[1]);
+ while (this.toolbarset.hasAttribute("toolbar" + (++index))) {
+ let hiddingAttribute =
+ this.toolbarset.getAttribute("type") == "menubar"
+ ? "autohide" : "collapsed";
+ let toolbarInfo = this.toolbarset.getAttribute("toolbar" + index);
+ let infoSplit = toolbarInfo.split(this.toolbarInfoSeparators[0]);
+ if (infoSplit.length == 1) {
+ infoSplit = toolbarInfo.split(this.toolbarInfoLegacySeparator);
+ }
+ let infoName = infoSplit[0];
+ let infoHidingAttribute = [null, null];
+ let infoCurrentSet = "";
+ let infoSplitLen = infoSplit.length;
+ switch (infoSplitLen) {
+ case 3:
+ // Pale Moon 27.2+
+ // Basilisk (UXP)
+ infoHidingAttribute = infoSplit[1]
+ .split(this.toolbarInfoSeparators[1]);
+ infoCurrentSet = infoSplit[2];
+ break;
+ case 2:
+ // Legacy:
+ // - toolbars from Pale Moon 27.0 - 27.1.x
+ // - Basilisk (moebius)
+ // The previous value (hiddingAttribute) isn't stored.
+ infoHidingAttribute = [hiddingAttribute, "false"];
+ infoCurrentSet = infoSplit[1];
+ break;
+ default:
+ Components.utils.reportError(
+ "Customizable toolbars - an invalid value:" + "\n"
+ + '"toolbar' + index + '" = "' + toolbarInfo + '"');
+ break;
+ }
+ this.appendCustomToolbar(
+ infoName, infoCurrentSet, infoHidingAttribute);
}
}
]]>
@@ -69,6 +105,7 @@
<method name="appendCustomToolbar">
<parameter name="aName"/>
<parameter name="aCurrentSet"/>
+ <parameter name="aHidingAttribute"/>
<body>
<![CDATA[
if (!this.toolbarset)
@@ -84,6 +121,10 @@
toolbar.setAttribute("iconsize", this.getAttribute("iconsize"));
toolbar.setAttribute("context", this.toolbarset.getAttribute("context"));
toolbar.setAttribute("class", "chromeclass-toolbar");
+ // Restore persist the hiding attribute.
+ if (aHidingAttribute[0]) {
+ toolbar.setAttribute(aHidingAttribute[0], aHidingAttribute[1]);
+ }
this.insertBefore(toolbar, this.toolbarset);
return toolbar;
diff --git a/toolkit/forgetaboutsite/ForgetAboutSite.jsm b/toolkit/forgetaboutsite/ForgetAboutSite.jsm
index 5250ca75d..8c7825392 100644
--- a/toolkit/forgetaboutsite/ForgetAboutSite.jsm
+++ b/toolkit/forgetaboutsite/ForgetAboutSite.jsm
@@ -45,175 +45,201 @@ const Ci = Components.interfaces;
const Cu = Components.utils;
this.ForgetAboutSite = {
- removeDataFromDomain: function CRH_removeDataFromDomain(aDomain)
+ removeDataFromDomain: Task.async(function* (aDomain)
{
PlacesUtils.history.removePagesFromHost(aDomain, true);
+ let promises = [];
// Cache
- let cs = Cc["@mozilla.org/netwerk/cache-storage-service;1"].
- getService(Ci.nsICacheStorageService);
- // NOTE: there is no way to clear just that domain, so we clear out
- // everything)
- try {
+ promises.push(Task.spawn(function*() {
+ let cs = Cc["@mozilla.org/netwerk/cache-storage-service;1"].
+ getService(Ci.nsICacheStorageService);
+ // NOTE: there is no way to clear just that domain, so we clear out
+ // everything)
cs.clear();
- } catch (ex) {
- Cu.reportError("Exception thrown while clearing the cache: " +
- ex.toString());
- }
+ }).catch(ex => {
+ throw new Error("Exception thrown while clearing the cache: " + ex);
+ }));
// Image Cache
- let imageCache = Cc["@mozilla.org/image/tools;1"].
- getService(Ci.imgITools).getImgCacheForDocument(null);
- try {
+ promises.push(Task.spawn(function*() {
+ let imageCache = Cc["@mozilla.org/image/tools;1"].
+ getService(Ci.imgITools).getImgCacheForDocument(null);
imageCache.clearCache(false); // true=chrome, false=content
- } catch (ex) {
- Cu.reportError("Exception thrown while clearing the image cache: " +
- ex.toString());
- }
+ }).catch(ex => {
+ throw new Error("Exception thrown while clearing the image cache: " + ex);
+ }));
// Cookies
- let cm = Cc["@mozilla.org/cookiemanager;1"].
- getService(Ci.nsICookieManager2);
- let enumerator = cm.getCookiesWithOriginAttributes(JSON.stringify({}), aDomain);
- while (enumerator.hasMoreElements()) {
- let cookie = enumerator.getNext().QueryInterface(Ci.nsICookie);
- cm.remove(cookie.host, cookie.name, cookie.path, false, cookie.originAttributes);
- }
+ // Need to maximize the number of cookies cleaned here
+ promises.push(Task.spawn(function*() {
+ let cm = Cc["@mozilla.org/cookiemanager;1"].
+ getService(Ci.nsICookieManager2);
+ let enumerator = cm.getCookiesWithOriginAttributes(JSON.stringify({}), aDomain);
+ while (enumerator.hasMoreElements()) {
+ let cookie = enumerator.getNext().QueryInterface(Ci.nsICookie);
+ cm.remove(cookie.host, cookie.name, cookie.path, false, cookie.originAttributes);
+ }
+ }).catch(ex => {
+ throw new Error("Exception thrown while clearning cookies: " + ex);
+ }));
// EME
- let mps = Cc["@mozilla.org/gecko-media-plugin-service;1"].
- getService(Ci.mozIGeckoMediaPluginChromeService);
- mps.forgetThisSite(aDomain, JSON.stringify({}));
+ promises.push(Task.spawn(function*() {
+ let mps = Cc["@mozilla.org/gecko-media-plugin-service;1"].
+ getService(Ci.mozIGeckoMediaPluginChromeService);
+ mps.forgetThisSite(aDomain, JSON.stringify({}));
+ }).catch(ex => {
+ throw new Error("Exception thrown while clearing Encrypted Media Extensions: " + ex);
+ }));
// Plugin data
const phInterface = Ci.nsIPluginHost;
const FLAG_CLEAR_ALL = phInterface.FLAG_CLEAR_ALL;
let ph = Cc["@mozilla.org/plugin/host;1"].getService(phInterface);
let tags = ph.getPluginTags();
- let promises = [];
for (let i = 0; i < tags.length; i++) {
- let promise = new Promise(resolve => {
- let tag = tags[i];
+ promises.push(new Promise(resolve => {
try {
- ph.clearSiteData(tags[i], aDomain, FLAG_CLEAR_ALL, -1, function(rv) {
- resolve();
- });
+ ph.clearSiteData(tags[i], aDomain, FLAG_CLEAR_ALL, -1, resolve);
} catch (e) {
// Ignore errors from the plugin, but resolve the promise
+ // We cannot check if something is a bailout or an error
resolve();
}
- });
- promises.push(promise);
+ }));
}
// Downloads
- Task.spawn(function*() {
+ promises.push(Task.spawn(function*() {
let list = yield Downloads.getList(Downloads.ALL);
list.removeFinished(download => hasRootDomain(
- NetUtil.newURI(download.source.url).host, aDomain));
- }).then(null, Cu.reportError);
+ NetUtil.newURI(download.source.url).host, aDomain));
+ }).catch(ex => {
+ throw new Error("Exception in clearing Downloads: " + ex);
+ }));
// Passwords
- let lm = Cc["@mozilla.org/login-manager;1"].
- getService(Ci.nsILoginManager);
- // Clear all passwords for domain
- try {
+ promises.push(Task.spawn(function*() {
+ let lm = Cc["@mozilla.org/login-manager;1"].
+ getService(Ci.nsILoginManager);
+ // Clear all passwords for domain
let logins = lm.getAllLogins();
- for (let i = 0; i < logins.length; i++)
- if (hasRootDomain(logins[i].hostname, aDomain))
+ for (let i = 0; i < logins.length; i++) {
+ if (hasRootDomain(logins[i].hostname, aDomain)) {
lm.removeLogin(logins[i]);
- }
- // XXXehsan: is there a better way to do this rather than this
- // hacky comparison?
- catch (ex) {
- if (!ex.message.includes("User canceled Master Password entry")) {
- throw ex;
+ }
}
- }
+ }).catch(ex => {
+ // XXX:
+ // Is there a better way to do this rather than this hacky comparison?
+ // Copied this from toolkit/components/passwordmgr/crypto-SDR.js
+ if (!ex.message.includes("User canceled master password entry")) {
+ throw new Error("Exception occured in clearing passwords: " + ex);
+ }
+ }));
// Permissions
let pm = Cc["@mozilla.org/permissionmanager;1"].
getService(Ci.nsIPermissionManager);
// Enumerate all of the permissions, and if one matches, remove it
- enumerator = pm.enumerator;
+ let enumerator = pm.enumerator;
while (enumerator.hasMoreElements()) {
let perm = enumerator.getNext().QueryInterface(Ci.nsIPermission);
- try {
- if (hasRootDomain(perm.principal.URI.host, aDomain)) {
- pm.removePermission(perm);
+ promises.push(new Promise((resolve, reject) => {
+ try {
+ if (hasRootDomain(perm.principal.URI.host, aDomain)) {
+ pm.removePermission(perm);
+ }
+ } catch (ex) {
+ // Ignore entry
+ } finally {
+ resolve();
}
- } catch (e) {
- /* Ignore entry */
- }
+ }));
}
// Offline Storages
- let qms = Cc["@mozilla.org/dom/quota-manager-service;1"].
- getService(Ci.nsIQuotaManagerService);
- // delete data from both HTTP and HTTPS sites
- let caUtils = {};
- let scriptLoader = Cc["@mozilla.org/moz/jssubscript-loader;1"].
- getService(Ci.mozIJSSubScriptLoader);
- scriptLoader.loadSubScript("chrome://global/content/contentAreaUtils.js",
- caUtils);
- let httpURI = caUtils.makeURI("http://" + aDomain);
- let httpsURI = caUtils.makeURI("https://" + aDomain);
- // Following code section has been reverted to the state before Bug 1238183,
- // but added a new argument to clearStoragesForPrincipal() for indicating
- // clear all storages under a given origin.
- let httpPrincipal = Services.scriptSecurityManager
- .createCodebasePrincipal(httpURI, {});
- let httpsPrincipal = Services.scriptSecurityManager
- .createCodebasePrincipal(httpsURI, {});
- qms.clearStoragesForPrincipal(httpPrincipal, null, true);
- qms.clearStoragesForPrincipal(httpsPrincipal, null, true);
-
-
- function onContentPrefsRemovalFinished() {
- // Everybody else (including extensions)
- Services.obs.notifyObservers(null, "browser:purge-domain-data", aDomain);
- }
+ promises.push(Task.spawn(function*() {
+ let qms = Cc["@mozilla.org/dom/quota-manager-service;1"].
+ getService(Ci.nsIQuotaManagerService);
+ // delete data from both HTTP and HTTPS sites
+ let httpURI = NetUtil.newURI("http://" + aDomain);
+ let httpsURI = NetUtil.newURI("https://" + aDomain);
+ // Following code section has been reverted to the state before Bug 1238183,
+ // but added a new argument to clearStoragesForPrincipal() for indicating
+ // clear all storages under a given origin.
+ let httpPrincipal = Services.scriptSecurityManager
+ .createCodebasePrincipal(httpURI, {});
+ let httpsPrincipal = Services.scriptSecurityManager
+ .createCodebasePrincipal(httpsURI, {});
+ qms.clearStoragesForPrincipal(httpPrincipal, null, true);
+ qms.clearStoragesForPrincipal(httpsPrincipal, null, true);
+ }).catch(ex => {
+ throw new Error("Exception occured while clearing offline storages: " + ex);
+ }));
// Content Preferences
- let cps2 = Cc["@mozilla.org/content-pref/service;1"].
- getService(Ci.nsIContentPrefService2);
- cps2.removeBySubdomain(aDomain, null, {
- handleCompletion: () => onContentPrefsRemovalFinished(),
- handleError: function() {}
- });
+ promises.push(Task.spawn(function*() {
+ let cps2 = Cc["@mozilla.org/content-pref/service;1"].
+ getService(Ci.nsIContentPrefService2);
+ cps2.removeBySubdomain(aDomain, null, {
+ handleCompletion: (reason) => {
+ // Notify other consumers, including extensions
+ Services.obs.notifyObservers(null, "browser:purge-domain-data", aDomain);
+ if (reason === cps2.COMPLETE_ERROR) {
+ throw new Error("Exception occured while clearing content preferences");
+ }
+ },
+ handleError() {}
+ });
+ }));
// Predictive network data - like cache, no way to clear this per
// domain, so just trash it all
- let np = Cc["@mozilla.org/network/predictor;1"].
- getService(Ci.nsINetworkPredictor);
- np.reset();
-
- // Push notifications.
- promises.push(new Promise(resolve => {
- var push = Cc["@mozilla.org/push/Service;1"]
- .getService(Ci.nsIPushService);
+ promises.push(Task.spawn(function*() {
+ let np = Cc["@mozilla.org/network/predictor;1"].
+ getService(Ci.nsINetworkPredictor);
+ np.reset();
+ }).catch(ex => {
+ throw new Error("Exception occured while clearing predictive network data: " + ex);
+ }));
+
+ // Push notifications
+ promises.push(Task.spawn(function*() {
+ var push = Cc["@mozilla.org/push/Service;1"].
+ getService(Ci.nsIPushService);
push.clearForDomain(aDomain, status => {
- (Components.isSuccessCode(status) ? resolve : reject)(status);
+ if (!Components.isSuccessCode(status)) {
+ throw new Error("Exception occured while clearing push notifications: " + status);
+ }
});
- }).catch(e => {
- Cu.reportError("Exception thrown while clearing Push notifications: " +
- e.toString());
}));
// HSTS and HPKP
// TODO (bug 1290529): also remove HSTS/HPKP information for subdomains.
// Since we can't enumerate the information in the site security service
// (bug 1115712), we can't implement this right now.
- try {
+ promises.push(Task.spawn(function*() {
let sss = Cc["@mozilla.org/ssservice;1"].
getService(Ci.nsISiteSecurityService);
+ let httpsURI = NetUtil.newURI("https://" + aDomain);
sss.removeState(Ci.nsISiteSecurityService.HEADER_HSTS, httpsURI, 0);
sss.removeState(Ci.nsISiteSecurityService.HEADER_HPKP, httpsURI, 0);
- } catch (e) {
- Cu.reportError("Exception thrown while clearing HSTS/HPKP: " +
- e.toString());
- }
+ }).catch(ex => {
+ throw new Error("Exception thrown while clearing HSTS/HPKP: " + ex);
+ }));
- return Promise.all(promises);
- }
-};
+ let ErrorCount = 0;
+ for (let promise of promises) {
+ try {
+ yield promise;
+ } catch (ex) {
+ Cu.reportError(ex);
+ ErrorCount++;
+ }
+ }
+ if (ErrorCount !== 0)
+ throw new Error(`There were a total of ${ErrorCount} errors during removal`);
+ })
+}
diff --git a/toolkit/forgetaboutsite/test/browser/browser_clearplugindata.js b/toolkit/forgetaboutsite/test/browser/browser_clearplugindata.js
index ec0a70228..ca0d394c3 100644
--- a/toolkit/forgetaboutsite/test/browser/browser_clearplugindata.js
+++ b/toolkit/forgetaboutsite/test/browser/browser_clearplugindata.js
@@ -37,7 +37,7 @@ function setTestPluginEnabledState(newEnabledState, plugin) {
});
}
-add_task(function* setup() {
+add_task(function* () {
var tags = pluginHost.getPluginTags();
// Find the test plugin
@@ -50,12 +50,9 @@ add_task(function* setup() {
}
if (!pluginTag) {
ok(false, "Test Plug-in not available, can't run test");
- finish();
+ return;
}
setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, pluginTag);
-});
-
-add_task(function* () {
yield BrowserTestUtils.openNewForegroundTab(gBrowser, testURL);
// Set data for the plugin after the page load.
@@ -87,5 +84,3 @@ add_task(function* () {
gBrowser.removeCurrentTab();
});
-
-
diff --git a/toolkit/forgetaboutsite/test/unit/test_removeDataFromDomain.js b/toolkit/forgetaboutsite/test/unit/test_removeDataFromDomain.js
index f6ace1e64..d2db95e6a 100644
--- a/toolkit/forgetaboutsite/test/unit/test_removeDataFromDomain.js
+++ b/toolkit/forgetaboutsite/test/unit/test_removeDataFromDomain.js
@@ -257,7 +257,7 @@ function* test_history_cleared_with_direct_match()
do_check_false(yield promiseIsURIVisited(TEST_URI));
yield PlacesTestUtils.addVisits(TEST_URI);
do_check_true(yield promiseIsURIVisited(TEST_URI));
- ForgetAboutSite.removeDataFromDomain("mozilla.org");
+ yield ForgetAboutSite.removeDataFromDomain("mozilla.org");
do_check_false(yield promiseIsURIVisited(TEST_URI));
}
@@ -267,7 +267,7 @@ function* test_history_cleared_with_subdomain()
do_check_false(yield promiseIsURIVisited(TEST_URI));
yield PlacesTestUtils.addVisits(TEST_URI);
do_check_true(yield promiseIsURIVisited(TEST_URI));
- ForgetAboutSite.removeDataFromDomain("mozilla.org");
+ yield ForgetAboutSite.removeDataFromDomain("mozilla.org");
do_check_false(yield promiseIsURIVisited(TEST_URI));
}
@@ -277,7 +277,7 @@ function* test_history_not_cleared_with_uri_contains_domain()
do_check_false(yield promiseIsURIVisited(TEST_URI));
yield PlacesTestUtils.addVisits(TEST_URI);
do_check_true(yield promiseIsURIVisited(TEST_URI));
- ForgetAboutSite.removeDataFromDomain("mozilla.org");
+ yield ForgetAboutSite.removeDataFromDomain("mozilla.org");
do_check_true(yield promiseIsURIVisited(TEST_URI));
// Clear history since we left something there from this test.
@@ -285,52 +285,52 @@ function* test_history_not_cleared_with_uri_contains_domain()
}
// Cookie Service
-function test_cookie_cleared_with_direct_match()
+function* test_cookie_cleared_with_direct_match()
{
const TEST_DOMAIN = "mozilla.org";
add_cookie(TEST_DOMAIN);
- ForgetAboutSite.removeDataFromDomain("mozilla.org");
+ yield ForgetAboutSite.removeDataFromDomain("mozilla.org");
check_cookie_exists(TEST_DOMAIN, false);
}
-function test_cookie_cleared_with_subdomain()
+function* test_cookie_cleared_with_subdomain()
{
const TEST_DOMAIN = "www.mozilla.org";
add_cookie(TEST_DOMAIN);
- ForgetAboutSite.removeDataFromDomain("mozilla.org");
+ yield ForgetAboutSite.removeDataFromDomain("mozilla.org");
check_cookie_exists(TEST_DOMAIN, false);
}
-function test_cookie_not_cleared_with_uri_contains_domain()
+function* test_cookie_not_cleared_with_uri_contains_domain()
{
const TEST_DOMAIN = "ilovemozilla.org";
add_cookie(TEST_DOMAIN);
- ForgetAboutSite.removeDataFromDomain("mozilla.org");
+ yield ForgetAboutSite.removeDataFromDomain("mozilla.org");
check_cookie_exists(TEST_DOMAIN, true);
}
// Login Manager
-function test_login_manager_disabled_hosts_cleared_with_direct_match()
+function* test_login_manager_disabled_hosts_cleared_with_direct_match()
{
const TEST_HOST = "http://mozilla.org";
add_disabled_host(TEST_HOST);
- ForgetAboutSite.removeDataFromDomain("mozilla.org");
+ yield ForgetAboutSite.removeDataFromDomain("mozilla.org");
check_disabled_host(TEST_HOST, false);
}
-function test_login_manager_disabled_hosts_cleared_with_subdomain()
+function* test_login_manager_disabled_hosts_cleared_with_subdomain()
{
const TEST_HOST = "http://www.mozilla.org";
add_disabled_host(TEST_HOST);
- ForgetAboutSite.removeDataFromDomain("mozilla.org");
+ yield ForgetAboutSite.removeDataFromDomain("mozilla.org");
check_disabled_host(TEST_HOST, false);
}
-function test_login_manager_disabled_hosts_not_cleared_with_uri_contains_domain()
+function* test_login_manager_disabled_hosts_not_cleared_with_uri_contains_domain()
{
const TEST_HOST = "http://ilovemozilla.org";
add_disabled_host(TEST_HOST);
- ForgetAboutSite.removeDataFromDomain("mozilla.org");
+ yield ForgetAboutSite.removeDataFromDomain("mozilla.org");
check_disabled_host(TEST_HOST, true);
// Reset state
@@ -340,27 +340,27 @@ function test_login_manager_disabled_hosts_not_cleared_with_uri_contains_domain(
check_disabled_host(TEST_HOST, false);
}
-function test_login_manager_logins_cleared_with_direct_match()
+function* test_login_manager_logins_cleared_with_direct_match()
{
const TEST_HOST = "http://mozilla.org";
add_login(TEST_HOST);
- ForgetAboutSite.removeDataFromDomain("mozilla.org");
+ yield ForgetAboutSite.removeDataFromDomain("mozilla.org");
check_login_exists(TEST_HOST, false);
}
-function test_login_manager_logins_cleared_with_subdomain()
+function* test_login_manager_logins_cleared_with_subdomain()
{
const TEST_HOST = "http://www.mozilla.org";
add_login(TEST_HOST);
- ForgetAboutSite.removeDataFromDomain("mozilla.org");
+ yield ForgetAboutSite.removeDataFromDomain("mozilla.org");
check_login_exists(TEST_HOST, false);
}
-function test_login_manager_logins_not_cleared_with_uri_contains_domain()
+function* test_login_manager_logins_not_cleared_with_uri_contains_domain()
{
const TEST_HOST = "http://ilovemozilla.org";
add_login(TEST_HOST);
- ForgetAboutSite.removeDataFromDomain("mozilla.org");
+ yield ForgetAboutSite.removeDataFromDomain("mozilla.org");
check_login_exists(TEST_HOST, true);
let lm = Cc["@mozilla.org/login-manager;1"].
@@ -370,27 +370,27 @@ function test_login_manager_logins_not_cleared_with_uri_contains_domain()
}
// Permission Manager
-function test_permission_manager_cleared_with_direct_match()
+function* test_permission_manager_cleared_with_direct_match()
{
const TEST_URI = uri("http://mozilla.org");
add_permission(TEST_URI);
- ForgetAboutSite.removeDataFromDomain("mozilla.org");
+ yield ForgetAboutSite.removeDataFromDomain("mozilla.org");
check_permission_exists(TEST_URI, false);
}
-function test_permission_manager_cleared_with_subdomain()
+function* test_permission_manager_cleared_with_subdomain()
{
const TEST_URI = uri("http://www.mozilla.org");
add_permission(TEST_URI);
- ForgetAboutSite.removeDataFromDomain("mozilla.org");
+ yield ForgetAboutSite.removeDataFromDomain("mozilla.org");
check_permission_exists(TEST_URI, false);
}
-function test_permission_manager_not_cleared_with_uri_contains_domain()
+function* test_permission_manager_not_cleared_with_uri_contains_domain()
{
const TEST_URI = uri("http://ilovemozilla.org");
add_permission(TEST_URI);
- ForgetAboutSite.removeDataFromDomain("mozilla.org");
+ yield ForgetAboutSite.removeDataFromDomain("mozilla.org");
check_permission_exists(TEST_URI, true);
// Reset state
@@ -427,7 +427,7 @@ function* test_content_preferences_cleared_with_direct_match()
do_check_false(yield preference_exists(TEST_URI));
yield add_preference(TEST_URI);
do_check_true(yield preference_exists(TEST_URI));
- ForgetAboutSite.removeDataFromDomain("mozilla.org");
+ yield ForgetAboutSite.removeDataFromDomain("mozilla.org");
yield waitForPurgeNotification();
do_check_false(yield preference_exists(TEST_URI));
}
@@ -438,7 +438,7 @@ function* test_content_preferences_cleared_with_subdomain()
do_check_false(yield preference_exists(TEST_URI));
yield add_preference(TEST_URI);
do_check_true(yield preference_exists(TEST_URI));
- ForgetAboutSite.removeDataFromDomain("mozilla.org");
+ yield ForgetAboutSite.removeDataFromDomain("mozilla.org");
yield waitForPurgeNotification();
do_check_false(yield preference_exists(TEST_URI));
}
@@ -449,12 +449,12 @@ function* test_content_preferences_not_cleared_with_uri_contains_domain()
do_check_false(yield preference_exists(TEST_URI));
yield add_preference(TEST_URI);
do_check_true(yield preference_exists(TEST_URI));
- ForgetAboutSite.removeDataFromDomain("mozilla.org");
+ yield ForgetAboutSite.removeDataFromDomain("mozilla.org");
yield waitForPurgeNotification();
do_check_true(yield preference_exists(TEST_URI));
// Reset state
- ForgetAboutSite.removeDataFromDomain("ilovemozilla.org");
+ yield ForgetAboutSite.removeDataFromDomain("ilovemozilla.org");
yield waitForPurgeNotification();
do_check_false(yield preference_exists(TEST_URI));
}
@@ -535,7 +535,7 @@ function* test_push_cleared()
}
// Cache
-function test_cache_cleared()
+function* test_cache_cleared()
{
// Because this test is asynchronous, it should be the last test
do_check_true(tests[tests.length - 1] == arguments.callee);
@@ -557,7 +557,7 @@ function test_cache_cleared()
}
};
os.addObserver(observer, "cacheservice:empty-cache", false);
- ForgetAboutSite.removeDataFromDomain("mozilla.org");
+ yield ForgetAboutSite.removeDataFromDomain("mozilla.org");
do_test_pending();
}
@@ -588,7 +588,7 @@ function* test_storage_cleared()
do_check_eq(storage.getItem("test"), "value" + i);
}
- ForgetAboutSite.removeDataFromDomain("mozilla.org");
+ yield ForgetAboutSite.removeDataFromDomain("mozilla.org");
yield waitForPurgeNotification();
do_check_eq(s[0].getItem("test"), null);
diff --git a/toolkit/jetpack/modules/system/Startup.js b/toolkit/jetpack/modules/system/Startup.js
index b9e5d88b3..89eeac3bc 100644
--- a/toolkit/jetpack/modules/system/Startup.js
+++ b/toolkit/jetpack/modules/system/Startup.js
@@ -15,6 +15,7 @@ const appStartupSrv = Cc["@mozilla.org/toolkit/app-startup;1"]
.getService(Ci.nsIAppStartup);
const NAME2TOPIC = {
+ 'Palemoon': 'sessionstore-windows-restored',
'Firefox': 'sessionstore-windows-restored',
'Fennec': 'sessionstore-windows-restored',
'SeaMonkey': 'sessionstore-windows-restored',
diff --git a/toolkit/jetpack/moz.build b/toolkit/jetpack/moz.build
index 2024e6a7c..2e5dbe5e8 100644
--- a/toolkit/jetpack/moz.build
+++ b/toolkit/jetpack/moz.build
@@ -85,10 +85,18 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] != "gonk":
'sdk/ui/toolbar.js',
]
+ if CONFIG['MC_PALEMOON']:
+ EXTRA_JS_MODULES.commonjs.sdk.ui += [
+ 'sdk/ui/buttons.js',
+ ]
+
EXTRA_JS_MODULES.commonjs.sdk.ui.button += [
'sdk/ui/button/action.js',
'sdk/ui/button/contract.js',
'sdk/ui/button/toggle.js',
+ ]
+
+ EXTRA_PP_JS_MODULES.commonjs.sdk.ui.button += [
'sdk/ui/button/view.js',
]
@@ -120,9 +128,10 @@ EXTRA_JS_MODULES.commonjs += [
'test.js',
]
-EXTRA_JS_MODULES.commonjs.sdk += [
- 'sdk/webextension.js',
-]
+if CONFIG['MOZ_WEBEXTENSIONS']:
+ EXTRA_JS_MODULES.commonjs.sdk += [
+ 'sdk/webextension.js',
+ ]
EXTRA_JS_MODULES.commonjs.dev += [
'dev/debuggee.js',
@@ -211,13 +220,15 @@ EXTRA_JS_MODULES.commonjs.sdk += [
'sdk/tabs.js',
'sdk/test.js',
'sdk/timers.js',
- 'sdk/ui.js',
'sdk/url.js',
'sdk/windows.js',
]
+EXTRA_PP_JS_MODULES.commonjs.sdk += [
+ 'sdk/ui.js',
+]
+
EXTRA_JS_MODULES.commonjs.sdk.addon += [
- 'sdk/addon/bootstrap.js',
'sdk/addon/events.js',
'sdk/addon/host.js',
'sdk/addon/installer.js',
@@ -226,6 +237,10 @@ EXTRA_JS_MODULES.commonjs.sdk.addon += [
'sdk/addon/window.js',
]
+EXTRA_PP_JS_MODULES.commonjs.sdk.addon += [
+ 'sdk/addon/bootstrap.js',
+]
+
EXTRA_JS_MODULES.commonjs.sdk.browser += [
'sdk/browser/events.js',
]
diff --git a/toolkit/jetpack/sdk/addon/bootstrap.js b/toolkit/jetpack/sdk/addon/bootstrap.js
index 0397d91e5..6c5827f1e 100644
--- a/toolkit/jetpack/sdk/addon/bootstrap.js
+++ b/toolkit/jetpack/sdk/addon/bootstrap.js
@@ -134,8 +134,10 @@ Bootstrap.prototype = {
const main = command === "test" ? "sdk/test/runner" : null;
const prefsURI = `${baseURI}defaults/preferences/prefs.js`;
+#ifdef MOZ_WEBEXTENSIONS
// Init the 'sdk/webextension' module from the bootstrap addon parameter.
require("sdk/webextension").initFromBootstrapAddonParam(addon);
+#endif
const { startup } = require("sdk/addon/runner");
startup(reason, {loader, main, prefsURI});
diff --git a/toolkit/jetpack/sdk/clipboard.js b/toolkit/jetpack/sdk/clipboard.js
index 048d5f2f1..c6b3c46fe 100644
--- a/toolkit/jetpack/sdk/clipboard.js
+++ b/toolkit/jetpack/sdk/clipboard.js
@@ -8,6 +8,7 @@ module.metadata = {
"stability": "stable",
"engines": {
// TODO Fennec Support 789757
+ "Palemoon": "*",
"Firefox": "*",
"SeaMonkey": "*",
"Thunderbird": "*"
diff --git a/toolkit/jetpack/sdk/context-menu.js b/toolkit/jetpack/sdk/context-menu.js
index 004c642d4..e00f41d79 100644
--- a/toolkit/jetpack/sdk/context-menu.js
+++ b/toolkit/jetpack/sdk/context-menu.js
@@ -7,6 +7,7 @@ module.metadata = {
"stability": "stable",
"engines": {
// TODO Fennec support Bug 788334
+ "Palemoon": "*",
"Firefox": "*",
"SeaMonkey": "*"
}
diff --git a/toolkit/jetpack/sdk/panel.js b/toolkit/jetpack/sdk/panel.js
index 4b625799d..34cde2edd 100644
--- a/toolkit/jetpack/sdk/panel.js
+++ b/toolkit/jetpack/sdk/panel.js
@@ -8,6 +8,7 @@
module.metadata = {
"stability": "stable",
"engines": {
+ "Palemoon": "*",
"Firefox": "*",
"SeaMonkey": "*"
}
diff --git a/toolkit/jetpack/sdk/places/bookmarks.js b/toolkit/jetpack/sdk/places/bookmarks.js
index c4f9528f1..e8fdae4f4 100644
--- a/toolkit/jetpack/sdk/places/bookmarks.js
+++ b/toolkit/jetpack/sdk/places/bookmarks.js
@@ -7,6 +7,7 @@
module.metadata = {
"stability": "unstable",
"engines": {
+ "Palemoon": "*",
"Firefox": "*",
"SeaMonkey": "*"
}
diff --git a/toolkit/jetpack/sdk/places/events.js b/toolkit/jetpack/sdk/places/events.js
index a3f95ee03..c5e728039 100644
--- a/toolkit/jetpack/sdk/places/events.js
+++ b/toolkit/jetpack/sdk/places/events.js
@@ -7,6 +7,7 @@
module.metadata = {
'stability': 'experimental',
'engines': {
+ 'Palemoon': '*',
'Firefox': '*',
"SeaMonkey": '*'
}
diff --git a/toolkit/jetpack/sdk/places/favicon.js b/toolkit/jetpack/sdk/places/favicon.js
index 05b057db1..7a74aa517 100644
--- a/toolkit/jetpack/sdk/places/favicon.js
+++ b/toolkit/jetpack/sdk/places/favicon.js
@@ -7,6 +7,7 @@
module.metadata = {
"stability": "unstable",
"engines": {
+ "Palemoon": "*",
"Firefox": "*",
"SeaMonkey": "*"
}
diff --git a/toolkit/jetpack/sdk/places/history.js b/toolkit/jetpack/sdk/places/history.js
index b243b024c..f7fc3ed57 100644
--- a/toolkit/jetpack/sdk/places/history.js
+++ b/toolkit/jetpack/sdk/places/history.js
@@ -7,6 +7,7 @@
module.metadata = {
"stability": "unstable",
"engines": {
+ "Palemoon": "*",
"Firefox": "*",
"SeaMonkey": "*"
}
diff --git a/toolkit/jetpack/sdk/places/host/host-bookmarks.js b/toolkit/jetpack/sdk/places/host/host-bookmarks.js
index 3245c4070..f6dec4069 100644
--- a/toolkit/jetpack/sdk/places/host/host-bookmarks.js
+++ b/toolkit/jetpack/sdk/places/host/host-bookmarks.js
@@ -7,6 +7,7 @@
module.metadata = {
"stability": "experimental",
"engines": {
+ "Palemoon": "*",
"Firefox": "*",
"SeaMonkey": "*"
}
diff --git a/toolkit/jetpack/sdk/places/host/host-query.js b/toolkit/jetpack/sdk/places/host/host-query.js
index f2dbd6550..a2cd4cd35 100644
--- a/toolkit/jetpack/sdk/places/host/host-query.js
+++ b/toolkit/jetpack/sdk/places/host/host-query.js
@@ -6,6 +6,7 @@
module.metadata = {
"stability": "experimental",
"engines": {
+ "Palemoon": "*",
"Firefox": "*",
"SeaMonkey": "*"
}
diff --git a/toolkit/jetpack/sdk/places/host/host-tags.js b/toolkit/jetpack/sdk/places/host/host-tags.js
index 929a5d5af..b94342549 100644
--- a/toolkit/jetpack/sdk/places/host/host-tags.js
+++ b/toolkit/jetpack/sdk/places/host/host-tags.js
@@ -7,6 +7,7 @@
module.metadata = {
"stability": "experimental",
"engines": {
+ "Palemoon": "*",
"Firefox": "*",
"SeaMonkey": "*"
}
diff --git a/toolkit/jetpack/sdk/places/utils.js b/toolkit/jetpack/sdk/places/utils.js
index 44366d2aa..fe928c4ea 100644
--- a/toolkit/jetpack/sdk/places/utils.js
+++ b/toolkit/jetpack/sdk/places/utils.js
@@ -7,6 +7,7 @@
module.metadata = {
"stability": "experimental",
"engines": {
+ "Palemoon": "*",
"Firefox": "*",
"SeaMonkey": "*"
}
diff --git a/toolkit/jetpack/sdk/selection.js b/toolkit/jetpack/sdk/selection.js
index 8682e8c6d..e393aae06 100644
--- a/toolkit/jetpack/sdk/selection.js
+++ b/toolkit/jetpack/sdk/selection.js
@@ -7,6 +7,7 @@
module.metadata = {
"stability": "stable",
"engines": {
+ "Palemoon": "*",
"Firefox": "*",
"SeaMonkey": "*"
}
diff --git a/toolkit/jetpack/sdk/system/xul-app.jsm b/toolkit/jetpack/sdk/system/xul-app.jsm
index 90681bb1b..ed760c3a4 100644
--- a/toolkit/jetpack/sdk/system/xul-app.jsm
+++ b/toolkit/jetpack/sdk/system/xul-app.jsm
@@ -41,6 +41,7 @@ var platformVersion = exports.platformVersion = appInfo.platformVersion;
// GUID.
var ids = exports.ids = {
+ Palemoon: "{8de7fcbb-c55c-4fbe-bfc5-fc555c87dbc4}",
Firefox: "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}",
Mozilla: "{86c18b42-e466-45a9-ae7a-9b95ba6f5640}",
SeaMonkey: "{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}",
diff --git a/toolkit/jetpack/sdk/ui.js b/toolkit/jetpack/sdk/ui.js
index 7f9110b26..d1ff7ceb8 100644
--- a/toolkit/jetpack/sdk/ui.js
+++ b/toolkit/jetpack/sdk/ui.js
@@ -6,12 +6,15 @@
module.metadata = {
'stability': 'experimental',
'engines': {
+ 'Palemoon': '> 27',
'Firefox': '> 28'
}
};
exports.ActionButton = require('./ui/button/action').ActionButton;
exports.ToggleButton = require('./ui/button/toggle').ToggleButton;
+#ifndef MC_PALEMOON
exports.Sidebar = require('./ui/sidebar').Sidebar;
exports.Frame = require('./ui/frame').Frame;
exports.Toolbar = require('./ui/toolbar').Toolbar;
+#endif
diff --git a/toolkit/jetpack/sdk/ui/button/action.js b/toolkit/jetpack/sdk/ui/button/action.js
index dfb092d0c..5355705be 100644
--- a/toolkit/jetpack/sdk/ui/button/action.js
+++ b/toolkit/jetpack/sdk/ui/button/action.js
@@ -6,6 +6,7 @@
module.metadata = {
'stability': 'experimental',
'engines': {
+ 'Palemoon': '> 27',
'Firefox': '> 28'
}
};
diff --git a/toolkit/jetpack/sdk/ui/button/toggle.js b/toolkit/jetpack/sdk/ui/button/toggle.js
index a226b3212..d8a3d1758 100644
--- a/toolkit/jetpack/sdk/ui/button/toggle.js
+++ b/toolkit/jetpack/sdk/ui/button/toggle.js
@@ -6,6 +6,7 @@
module.metadata = {
'stability': 'experimental',
'engines': {
+ 'Palemoon': '> 27',
'Firefox': '> 28'
}
};
diff --git a/toolkit/jetpack/sdk/ui/button/view.js b/toolkit/jetpack/sdk/ui/button/view.js
index 63b7aea31..dcc3be59d 100644
--- a/toolkit/jetpack/sdk/ui/button/view.js
+++ b/toolkit/jetpack/sdk/ui/button/view.js
@@ -6,6 +6,7 @@
module.metadata = {
'stability': 'experimental',
'engines': {
+ 'Palemoon': '> 27',
'Firefox': '> 28'
}
};
@@ -19,14 +20,19 @@ const { isObject, isNil } = require('../../lang/type');
const { getMostRecentBrowserWindow } = require('../../window/utils');
const { ignoreWindow } = require('../../private-browsing/utils');
+#ifdef MC_PALEMOON
+const { buttons } = require('../buttons');
+#else
const { CustomizableUI } = Cu.import('resource:///modules/CustomizableUI.jsm', {});
const { AREA_PANEL, AREA_NAVBAR } = CustomizableUI;
+#endif
const { events: viewEvents } = require('./view/events');
const XUL_NS = 'http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul';
const views = new Map();
+#ifndef MC_PALEMOON
const customizedWindows = new WeakMap();
const buttonListener = {
@@ -64,19 +70,25 @@ CustomizableUI.addListener(buttonListener);
require('../../system/unload').when( _ =>
CustomizableUI.removeListener(buttonListener)
);
+#endif
function getNode(id, window) {
return !views.has(id) || ignoreWindow(window)
? null
+#ifdef MC_PALEMOON
+ : buttons.getNode(id, window);
+#else
: CustomizableUI.getWidget(id).forWindow(window).node
+#endif
};
+#ifndef MC_PALEMOON
function isInToolbar(id) {
let placement = CustomizableUI.getPlacementOfWidget(id);
return placement && CustomizableUI.getAreaType(placement.area) === 'toolbar';
}
-
+#endif
function getImage(icon, isInToolbar, pixelRatio) {
let targetSize = (isInToolbar ? 18 : 32) * pixelRatio;
@@ -109,7 +121,11 @@ function getImage(icon, isInToolbar, pixelRatio) {
}
function nodeFor(id, window=getMostRecentBrowserWindow()) {
+#ifdef MC_PALEMOON
+ return getNode(id, window);
+#else
return customizedWindows.has(window) ? null : getNode(id, window);
+#endif
};
exports.nodeFor = nodeFor;
@@ -119,14 +135,23 @@ function create(options) {
if (views.has(id))
throw new Error('The ID "' + id + '" seems already used.');
+#ifdef MC_PALEMOON
+ buttons.createButton({
+#else
CustomizableUI.createWidget({
+#endif
id: id,
type: 'custom',
+#ifdef MC_PALEMOON
+
+ onBuild: function(document, _id) {
+#else
removable: true,
defaultArea: AREA_NAVBAR,
allowedAreas: [ AREA_PANEL, AREA_NAVBAR ],
onBuild: function(document) {
+#endif
let window = document.defaultView;
let node = document.createElementNS(XUL_NS, 'toolbarbutton');
@@ -136,16 +161,26 @@ function create(options) {
if (ignoreWindow(window))
node.style.display = 'none';
+#ifdef MC_PALEMOON
+ node.setAttribute('id', _id);
+#else
node.setAttribute('id', this.id);
+#endif
node.setAttribute('class', 'toolbarbutton-1 chromeclass-toolbar-additional badged-button');
node.setAttribute('type', type);
node.setAttribute('label', label);
node.setAttribute('tooltiptext', label);
node.setAttribute('image', image);
+#ifdef MC_PALEMOON
+ node.setAttribute('pmkit-button', 'true');
+#else
node.setAttribute('constrain-size', 'true');
+#endif
views.set(id, {
+#ifndef MC_PALEMOON
area: this.currentArea,
+#endif
icon: icon,
label: label
});
@@ -171,7 +206,11 @@ function dispose(id) {
if (!views.has(id)) return;
views.delete(id);
+#ifdef MC_PALEMOON
+ buttons.destroyButton(id);
+#else
CustomizableUI.destroyWidget(id);
+#endif
}
exports.dispose = dispose;
@@ -179,8 +218,12 @@ function setIcon(id, window, icon) {
let node = getNode(id, window);
if (node) {
+#ifdef MC_PALEMOON
+ let image = getImage(icon, true, window.devicePixelRatio);
+#else
icon = customizedWindows.has(window) ? views.get(id).icon : icon;
let image = getImage(icon, isInToolbar(id), window.devicePixelRatio);
+#endif
node.setAttribute('image', image);
}
diff --git a/toolkit/jetpack/sdk/ui/button/view/events.js b/toolkit/jetpack/sdk/ui/button/view/events.js
index 98909656a..34d14be3a 100644
--- a/toolkit/jetpack/sdk/ui/button/view/events.js
+++ b/toolkit/jetpack/sdk/ui/button/view/events.js
@@ -7,6 +7,7 @@
module.metadata = {
'stability': 'experimental',
'engines': {
+ 'Palemoon': '*',
'Firefox': '*',
'SeaMonkey': '*',
'Thunderbird': '*'
diff --git a/toolkit/jetpack/sdk/ui/buttons.js b/toolkit/jetpack/sdk/ui/buttons.js
new file mode 100644
index 000000000..66e0fd742
--- /dev/null
+++ b/toolkit/jetpack/sdk/ui/buttons.js
@@ -0,0 +1,198 @@
+/* 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/.
+ * PMkit shim for 'sdk/ui/button', (c) JustOff, 2017 */
+"use strict";
+
+module.metadata = {
+ "stability": "experimental",
+ "engines": {
+ "Palemoon": "> 27"
+ }
+};
+
+const { Ci, Cc } = require('chrome');
+const prefs = require('../preferences/service');
+
+const buttonsList = new Map();
+const LOCATION_PREF_ROOT = "extensions.sdk-button-location.";
+
+let gWindowListener;
+
+function getLocation(id) {
+ let toolbarId = "nav-bar", nextItemId = "";
+ let location = prefs.get(LOCATION_PREF_ROOT + id);
+ if (location && location.indexOf(",") !== -1) {
+ [toolbarId, nextItemId] = location.split(",");
+ }
+ return [toolbarId, nextItemId];
+}
+
+function saveLocation(id, toolbarId, nextItemId) {
+ let _toolbarId = toolbarId || "";
+ let _nextItemId = nextItemId || "";
+ prefs.set(LOCATION_PREF_ROOT + id, [_toolbarId, _nextItemId].join(","));
+}
+
+// Insert button into window
+function insertButton(aWindow, id, onBuild) {
+ // Build button and save reference to it
+ let doc = aWindow.document;
+ let b = onBuild(doc, id);
+ aWindow[id] = b;
+
+ // Add to the customization palette
+ let toolbox = doc.getElementById("navigator-toolbox");
+ toolbox.palette.appendChild(b);
+
+ // Retrieve button location from preferences
+ let [toolbarId, nextItemId] = getLocation(id);
+ let toolbar = toolbarId != "" && doc.getElementById(toolbarId);
+
+ if (toolbar) {
+ let nextItem = doc.getElementById(nextItemId);
+ // If nextItem not in toolbar then retrieve it by reading currentset attribute
+ if (!(nextItem && nextItem.parentNode && nextItem.parentNode.id == toolbarId)) {
+ nextItem = null;
+ let currentSet = toolbar.getAttribute("currentset");
+ let ids = (currentSet == "__empty") ? [] : currentSet.split(",");
+ let idx = ids.indexOf(id);
+ if (idx != -1) {
+ for (let i = idx; i < ids.length; i++) {
+ nextItem = doc.getElementById(ids[i]);
+ if (nextItem)
+ break;
+ }
+ }
+ }
+ // Finally insert button in the right toolbar and in the right position
+ toolbar.insertItem(id, nextItem, null, false);
+ }
+}
+
+// Remove button from window
+function removeButton(aWindow, id) {
+ let b = aWindow[id];
+ b.parentNode.removeChild(b);
+ delete aWindow[id];
+}
+
+// Save locations of buttons after customization
+function afterCustomize(e) {
+ for (let [id] of buttonsList) {
+ let toolbox = e.target;
+ let b = toolbox.parentNode.querySelector("#" + id);
+ let toolbarId = null, nextItemId = null;
+ if (b) {
+ let parent = b.parentNode;
+ let nextItem = b.nextSibling;
+ if (parent && parent.localName == "toolbar") {
+ toolbarId = parent.id;
+ nextItemId = nextItem && nextItem.id;
+ }
+ }
+ saveLocation(id, toolbarId, nextItemId);
+ }
+}
+
+// Global window observer
+function browserWindowObserver(handlers) {
+ this.handlers = handlers;
+}
+
+browserWindowObserver.prototype = {
+ observe: function(aSubject, aTopic, aData) {
+ if (aTopic == "domwindowopened") {
+ aSubject.QueryInterface(Ci.nsIDOMWindow).addEventListener("load", this, false);
+ } else if (aTopic == "domwindowclosed") {
+ if (aSubject.document.documentElement.getAttribute("windowtype") == "navigator:browser") {
+ this.handlers.onShutdown(aSubject);
+ }
+ }
+ },
+
+ handleEvent: function(aEvent) {
+ let aWindow = aEvent.currentTarget;
+ aWindow.removeEventListener(aEvent.type, this, false);
+
+ if (aWindow.document.documentElement.getAttribute("windowtype") == "navigator:browser") {
+ this.handlers.onStartup(aWindow);
+ }
+ }
+};
+
+// Run on every window startup
+function browserWindowStartup(aWindow) {
+ for (let [id, onBuild] of buttonsList) {
+ insertButton(aWindow, id, onBuild);
+ }
+ aWindow.addEventListener("aftercustomization", afterCustomize, false);
+};
+
+// Run on every window shutdown
+function browserWindowShutdown(aWindow) {
+ for (let [id, onBuild] of buttonsList) {
+ removeButton(aWindow, id);
+ }
+ aWindow.removeEventListener("aftercustomization", afterCustomize, false);
+}
+
+// Main object
+const buttons = {
+ createButton: function(aProperties) {
+ // If no buttons were inserted yet, setup global window observer
+ if (buttonsList.size == 0) {
+ let ww = Cc["@mozilla.org/embedcomp/window-watcher;1"].getService(Ci.nsIWindowWatcher);
+ gWindowListener = new browserWindowObserver({
+ onStartup: browserWindowStartup,
+ onShutdown: browserWindowShutdown
+ });
+ ww.registerNotification(gWindowListener);
+ }
+
+ // Add button to list
+ buttonsList.set(aProperties.id, aProperties.onBuild);
+
+ // Inster button to all open windows
+ let wm = Cc["@mozilla.org/appshell/window-mediator;1"].getService(Ci.nsIWindowMediator);
+ let winenu = wm.getEnumerator("navigator:browser");
+ while (winenu.hasMoreElements()) {
+ let win = winenu.getNext();
+ insertButton(win, aProperties.id, aProperties.onBuild);
+ // When first button inserted, add afterCustomize listener
+ if (buttonsList.size == 1) {
+ win.addEventListener("aftercustomization", afterCustomize, false);
+ }
+ }
+ },
+
+ destroyButton: function(id) {
+ // Remove button from list
+ buttonsList.delete(id);
+
+ // If no more buttons exist, remove global window observer
+ if (buttonsList.size == 0) {
+ let ww = Cc["@mozilla.org/embedcomp/window-watcher;1"].getService(Ci.nsIWindowWatcher);
+ ww.unregisterNotification(gWindowListener);
+ gWindowListener = null;
+ }
+
+ // Remove button from all open windows
+ let wm = Cc["@mozilla.org/appshell/window-mediator;1"].getService(Ci.nsIWindowMediator);
+ let winenu = wm.getEnumerator("navigator:browser");
+ while (winenu.hasMoreElements()) {
+ let win = winenu.getNext();
+ removeButton(win, id);
+ // If no more buttons exist, remove afterCustomize listener
+ if (buttonsList.size == 0) {
+ win.removeEventListener("aftercustomization", afterCustomize, false);
+ }
+ }
+ },
+
+ getNode: function(id, window) {
+ return window[id];
+ }
+};
+
+exports.buttons = buttons;
diff --git a/toolkit/jetpack/sdk/ui/state.js b/toolkit/jetpack/sdk/ui/state.js
index 152ce696d..c90d4283d 100644
--- a/toolkit/jetpack/sdk/ui/state.js
+++ b/toolkit/jetpack/sdk/ui/state.js
@@ -8,6 +8,7 @@
module.metadata = {
'stability': 'experimental',
'engines': {
+ 'Palemoon': '*',
'Firefox': '*',
'SeaMonkey': '*',
'Thunderbird': '*'
diff --git a/toolkit/jetpack/sdk/ui/state/events.js b/toolkit/jetpack/sdk/ui/state/events.js
index 98909656a..34d14be3a 100644
--- a/toolkit/jetpack/sdk/ui/state/events.js
+++ b/toolkit/jetpack/sdk/ui/state/events.js
@@ -7,6 +7,7 @@
module.metadata = {
'stability': 'experimental',
'engines': {
+ 'Palemoon': '*',
'Firefox': '*',
'SeaMonkey': '*',
'Thunderbird': '*'
diff --git a/toolkit/locales/Makefile.in b/toolkit/locales/Makefile.in
index e20128611..189e0b1b0 100644
--- a/toolkit/locales/Makefile.in
+++ b/toolkit/locales/Makefile.in
@@ -30,11 +30,3 @@ chrome-%:
libs:: update.locale
sed -e 's/%AB_CD%/$(AB_CD)/' $< > $(FINAL_TARGET)/update.locale
-ifdef MOZ_CRASHREPORTER
-libs:: crashreporter.ini
-ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
- $(SYSINSTALL) $(IFLAGS1) $^ $(FINAL_TARGET)/crashreporter.app/Contents/Resources
-else
- $(SYSINSTALL) $(IFLAGS1) $^ $(FINAL_TARGET)
-endif
-endif
diff --git a/toolkit/locales/en-US/chrome/global/about.dtd b/toolkit/locales/en-US/chrome/global/about.dtd
index 6df685747..85c1a6d25 100644
--- a/toolkit/locales/en-US/chrome/global/about.dtd
+++ b/toolkit/locales/en-US/chrome/global/about.dtd
@@ -1,13 +1,13 @@
<!-- 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/. -->
-<!ENTITY about.version "version">
+<!ENTITY about.version "Version">
<!-- LOCALIZATION NOTE (about.credits.beforeLink): note that there is no space between this phrase and the linked about.credits.linkTitle phrase, so if your locale needs a space between words, add it at the end of this entity. -->
<!ENTITY about.credits.beforeLink "See a list of ">
<!ENTITY about.credits.linkTitle "contributors">
<!-- LOCALIZATION NOTE (about.credits.afterLink): note that there is no space between the linked about.credits.linkTitle phrase and this phrase, so if your locale needs a space between words, add it at the start of this entity. -->
-<!ENTITY about.credits.afterLink " to the Mozilla Project.">
+<!ENTITY about.credits.afterLink " to the project.">
<!-- LOCALIZATION NOTE (about.license.beforeTheLink): note that there is no space between this phrase and the linked about.license.linkTitle phrase, so if your locale needs a space between words, add it at the end of this entity. -->
<!ENTITY about.license.beforeTheLink "Read the ">
@@ -27,4 +27,5 @@
<!-- LOCALIZATION NOTE (about.buildconfig.afterTheLink): note that there is no space between the linked about.buildconfig.linkTitle phrase and this phrase, so if your locale needs a space between words, add it at the start of this entity. -->
<!ENTITY about.buildconfig.afterTheLink " used for this version.">
-<!ENTITY about.buildIdentifier "Build identifier: ">
+<!ENTITY about.buildIdentifier "Build identifier:">
+<!ENTITY about.userAgent "User-agent:">
diff --git a/toolkit/locales/en-US/chrome/global/aboutRights.dtd b/toolkit/locales/en-US/chrome/global/aboutRights.dtd
index 319984d41..28b24e1d8 100644
--- a/toolkit/locales/en-US/chrome/global/aboutRights.dtd
+++ b/toolkit/locales/en-US/chrome/global/aboutRights.dtd
@@ -19,12 +19,12 @@
<!ENTITY rights.intro-point1b "Mozilla Public License">
<!ENTITY rights.intro-point1c ". This means you may use, copy and distribute &brandShortName; to others. You are also welcome to modify the source code of &brandShortName; as you want to meet your needs. The Mozilla Public License also gives you the right to distribute your modified versions.">
-<!ENTITY rights.intro-point2-a "You are not granted any trademark rights or licenses to the trademarks of the Mozilla Foundation or any party, including without limitation the Firefox name or logo. Additional information on trademarks may be found ">
+<!ENTITY rights.intro-point2-a "You are not granted any trademark rights or licenses to the trademarks of Moonchild Productions or any other party, including without limitation the Basilisk and Pale Moon names or logos. Additional information on trademarks may be found ">
<!ENTITY rights.intro-point2-b "here">
<!ENTITY rights.intro-point2-c ".">
<!-- point 2.5 text for official branded builds -->
-<!ENTITY rights.intro-point2.5 "Some features in &brandShortName;, such as the Crash Reporter, give you the option to provide feedback to &vendorShortName;. By choosing to submit feedback, you give &vendorShortName; permission to use the feedback to improve its products, to publish the feedback on its websites, and to distribute the feedback.">
+<!ENTITY rights.intro-point2.5 "Some features in &brandShortName; give you the option to provide feedback to the publishers of this software. By choosing to submit feedback, you give the publishers in question permission to use the feedback to improve their products, to publish the feedback on their websites, and to distribute the feedback.">
<!-- point 3 text for official branded builds -->
<!ENTITY rights2.intro-point3a "How we use your personal information and feedback submitted to &vendorShortName; through &brandShortName; is described in the ">
@@ -47,7 +47,7 @@
<!ENTITY rights2.webservices-header "&brandFullName; Web-Based Information Services">
<!-- point 5 -->
-<!ENTITY rights.intro-point5 "In order to play back certain types of video content, &brandShortName; downloads certain content decryption modules from third parties.">
+<!ENTITY rights.intro-point5 "In order to play back certain types of video content, &brandShortName; may download certain content decryption modules from third parties, if playback of DRM content is enabled or available.">
<!-- Note that this paragraph references a couple of entities from
preferences/security.dtd, so that we can refer to text the user sees in
@@ -59,6 +59,8 @@
<!ENTITY rights3.webservices-c ". Other features and Services can be disabled in the application preferences.">
<!-- safe browsing points for branded builds -->
+<!-- Google SafeBrowsing requires an API key; this should always remain disabled unless
+ an API key is obtained. Official builds do not use SafeBrowsing. -->
<!ENTITY rights.safebrowsing-a "SafeBrowsing: ">
<!ENTITY rights.safebrowsing-b "Disabling the Safe Browsing feature is not recommended as it may result in you going to unsafe sites. If you wish to disable the feature completely, follow these steps:">
<!ENTITY rights.safebrowsing-term1 "Open the application preferences">
@@ -67,6 +69,7 @@
<!ENTITY rights.safebrowsing-term4 "Safe Browsing is now disabled">
<!-- location aware browsing points for branded builds -->
+<!-- Official builds use IP-API.com -->
<!ENTITY rights.locationawarebrowsing-a "Location Aware Browsing: ">
<!ENTITY rights.locationawarebrowsing-b "is always opt-in. No location information is ever sent without your permission. If you wish to disable the feature completely, follow these steps:">
<!ENTITY rights.locationawarebrowsing-term1a "In the URL bar, type ">
@@ -82,10 +85,10 @@
<!ENTITY rights.webservices-term1-unbranded "Any applicable service terms for this product should be listed here.">
<!-- points 1-7 text for branded builds -->
-<!ENTITY rights2.webservices-term1 "&vendorShortName; and its contributors, licensors and partners work to provide the most accurate and up-to-date Services. However, we cannot guarantee that this information is comprehensive and error-free. For example, the Safe Browsing Service may not identify some risky sites and may identify some safe sites in error and the Location Aware Service all locations returned by our service providers are estimates only and neither we nor our service providers guarantee the accuracy of the locations provided.">
+<!ENTITY rights2.webservices-term1 "&vendorShortName; and its contributors, licensors and partners work to provide the most accurate and up-to-date Services. However, we cannot guarantee that this information is comprehensive and error-free. For example, for the Location Aware Service all locations returned by our service provider are estimates only and neither we nor our service provider guarantee the accuracy of the locations provided.">
<!ENTITY rights.webservices-term2 "&vendorShortName; may discontinue or change the Services at its discretion.">
-<!ENTITY rights2.webservices-term3 "You are welcome to use these Services with the accompanying version of &brandShortName;, and &vendorShortName; grants you its rights to do so. &vendorShortName; and its licensors reserve all other rights in the Services. These terms are not intended to limit any rights granted under open source licenses applicable to &brandShortName; and to corresponding source code versions of &brandShortName;.">
-<!ENTITY rights.webservices-term4 "The Services are provided &quot;as-is.&quot; &vendorShortName;, its contributors, licensors, and distributors, disclaim all warranties, whether express or implied, including without limitation, warranties that the Services are merchantable and fit for your particular purposes. You bear the entire risk as to selecting the Services for your purposes and as to the quality and performance of the Services. Some jurisdictions do not allow the exclusion or limitation of implied warranties, so this disclaimer may not apply to you.">
-<!ENTITY rights.webservices-term5 "Except as required by law, &vendorShortName;, its contributors, licensors, and distributors will not be liable for any indirect, special, incidental, consequential, punitive, or exemplary damages arising out of or in any way relating to the use of &brandShortName; and the Services. The collective liability under these terms will not exceed $500 (five hundred dollars). Some jurisdictions do not allow the exclusion or limitation of certain damages, so this exclusion and limitation may not apply to you.">
+<!ENTITY rights2.webservices-term3 "You are welcome to use these Services with the accompanying version of &brandShortName;, and &vendorShortName; grants you its rights to do so. &vendorShortName; and its licensors reserve all other rights in the Services. These terms are not intended to limit any rights granted under open source licenses applicable to &brandShortName; and to corresponding source code versions of &brandShortName;, however these (optional) services are provided asa convenience to you, and in no way extend your software rights to the Services.">
+<!ENTITY rights.webservices-term4 "The Services are provided &quot;as-is&quot; and &quot;as-available&quot;. &vendorShortName;, its contributors, licensors and distributors disclaim all warranties, whether express or implied, including without limitation warranties that the Services are merchantable and fit for your particular purposes. You bear the entire risk as to selecting the Services for your purposes and as to the quality and performance of the Services. If your jurisdiction does not allow disclaiming of warranties, then you should not use &brandShortName; or Services.">
+<!ENTITY rights.webservices-term5 "Except as required by law, &vendorShortName;, its contributors, licensors, and distributors will not be liable for any indirect, special, incidental, consequential, punitive, or exemplary damages arising out of or in any way relating to the use of &brandShortName; and the Services. The collective liability under these terms will not exceed $500 (five hundred dollars). If your jurisdiction does not allow the exclusion or limitation of damages, then you should not use &brandShortName; or Services.">
<!ENTITY rights.webservices-term6 "&vendorShortName; may update these terms as necessary from time to time. These terms may not be modified or canceled without &vendorShortName;'s written agreement.">
-<!ENTITY rights.webservices-term7 "These terms are governed by the laws of the state of California, U.S.A., excluding its conflict of law provisions. If any portion of these terms is held to be invalid or unenforceable, the remaining portions will remain in full force and effect. In the event of a conflict between a translated version of these terms and the English language version, the English language version shall control.">
+<!ENTITY rights.webservices-term7 "These terms are governed by the laws of Sweden, excluding any conflict of law provisions. If any portion of these terms is held to be invalid or unenforceable, the remaining portions will remain in full force and effect. In the event of a conflict between a translated version of these terms and the English language version, the English language version shall take precedence.">
diff --git a/toolkit/locales/en-US/chrome/global/autocomplete.properties b/toolkit/locales/en-US/chrome/global/autocomplete.properties
index 5c7c84b96..44da643ac 100644
--- a/toolkit/locales/en-US/chrome/global/autocomplete.properties
+++ b/toolkit/locales/en-US/chrome/global/autocomplete.properties
@@ -1,6 +1,11 @@
# 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/.
+switchToTab = Switch to tab
+
+# LOCALIZATION NOTE (visitURL):
+# %S is the URL to visit.
+visitURL = Visit %S
# LOCALIZATION NOTE (searchWithEngine): %S will be replaced with
# the search engine provider's name. This format was chosen because
diff --git a/toolkit/locales/en-US/chrome/global/customizeToolbar.properties b/toolkit/locales/en-US/chrome/global/customizeToolbar.properties
index 0ec6d2c1d..b19152fab 100644
--- a/toolkit/locales/en-US/chrome/global/customizeToolbar.properties
+++ b/toolkit/locales/en-US/chrome/global/customizeToolbar.properties
@@ -5,6 +5,7 @@
enterToolbarTitle=New Toolbar
enterToolbarName=Enter a name for this toolbar:
enterToolbarDup=There is already a toolbar with the name “%S”. Please enter a different name.
+enterToolbarIllegalChars=The name contains illegal character "|". Please enter a different name.
enterToolbarBlank=You must enter a name to create a new toolbar.
separatorTitle=Separator
springTitle=Flexible Space
diff --git a/toolkit/locales/en-US/chrome/global/datetimebox.dtd b/toolkit/locales/en-US/chrome/global/datetimebox.dtd
new file mode 100644
index 000000000..0deffa6b3
--- /dev/null
+++ b/toolkit/locales/en-US/chrome/global/datetimebox.dtd
@@ -0,0 +1,9 @@
+<!-- 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/. -->
+
+<!-- Placeholders for input type=date -->
+
+<!ENTITY date.year.placeholder "yyyy">
+<!ENTITY date.month.placeholder "mm">
+<!ENTITY date.day.placeholder "dd">
diff --git a/toolkit/locales/en-US/chrome/global/findbar.dtd b/toolkit/locales/en-US/chrome/global/findbar.dtd
index ad77130bc..a90c77c7e 100644
--- a/toolkit/locales/en-US/chrome/global/findbar.dtd
+++ b/toolkit/locales/en-US/chrome/global/findbar.dtd
@@ -5,7 +5,11 @@
<!-- LOCALIZATION NOTE : FILE This file contains the entities needed to -->
<!-- LOCALIZATION NOTE : FILE use the Find Bar. -->
+<!ENTITY next.label "Next">
+<!ENTITY next.accesskey "N">
<!ENTITY next.tooltip "Find the next occurrence of the phrase">
+<!ENTITY previous.label "Previous">
+<!ENTITY previous.accesskey "P">
<!ENTITY previous.tooltip "Find the previous occurrence of the phrase">
<!ENTITY findCloseButton.tooltip "Close find bar">
<!ENTITY highlightAll.label "Highlight All">
diff --git a/toolkit/locales/en-US/chrome/mozapps/preferences/changemp.dtd b/toolkit/locales/en-US/chrome/mozapps/preferences/changemp.dtd
index 1cc7b9621..1b1d5ac55 100644
--- a/toolkit/locales/en-US/chrome/mozapps/preferences/changemp.dtd
+++ b/toolkit/locales/en-US/chrome/mozapps/preferences/changemp.dtd
@@ -9,5 +9,5 @@
<!ENTITY setPassword.reenterPassword.label "Re-enter password:">
<!ENTITY setPassword.meter.label "Password quality meter">
<!ENTITY setPassword.meter.loading "Loading">
-<!ENTITY masterPasswordDescription.label "A Master Password is used to protect sensitive information like site passwords. If you create a Master Password you will be asked to enter it once per session when &brandShortName; retrieves saved information protected by the password.">
+<!ENTITY masterPasswordDescription.label "A Master Password is used to protect sensitive information like site passwords. If you create a Master Password you will be asked to enter it once per session when &brandShortName; retrieves saved information protected by the password. A master password must be 8 characters or longer; longer is better.">
<!ENTITY masterPasswordWarning.label "Please make sure you remember the Master Password you have set. If you forget your Master Password, you will be unable to access any of the information protected by it.">
diff --git a/toolkit/locales/en-US/chrome/passwordmgr/passwordManager.dtd b/toolkit/locales/en-US/chrome/passwordmgr/passwordManager.dtd
index 36a61cfd9..84e4ff69c 100644
--- a/toolkit/locales/en-US/chrome/passwordmgr/passwordManager.dtd
+++ b/toolkit/locales/en-US/chrome/passwordmgr/passwordManager.dtd
@@ -17,8 +17,6 @@
<!ENTITY remove.label "Remove">
<!ENTITY remove.accesskey "R">
-<!ENTITY removeall.label "Remove All">
-<!ENTITY removeall.accesskey "A">
<!ENTITY addLogin.label "Add Login">
<!ENTITY addLogin.accesskey "L">
diff --git a/toolkit/locales/en-US/chrome/passwordmgr/passwordmgr.properties b/toolkit/locales/en-US/chrome/passwordmgr/passwordmgr.properties
index 96190a2d7..6a399bbfc 100644
--- a/toolkit/locales/en-US/chrome/passwordmgr/passwordmgr.properties
+++ b/toolkit/locales/en-US/chrome/passwordmgr/passwordmgr.properties
@@ -68,3 +68,14 @@ duplicateLogin=A duplicate login already exists.
insecureFieldWarningDescription = This connection is not secure. Logins entered here could be compromised.
insecureFieldWarningLearnMore = Learn More
+
+# LOCALIZATION NOTE (removeAll, removeAllShown):
+# removeAll and removeAllShown are both used on the same one button,
+# never displayed together and can share the same accesskey.
+# When only partial sites are shown as a result of keyword search,
+# removeAllShown is displayed as button label.
+# removeAll is displayed when no keyword search and all sites are shown.
+removeAll.label=Remove All
+removeAll.accesskey=A
+removeAllShown.label=Remove All Shown
+removeAllShown.accesskey=A
diff --git a/toolkit/locales/en-US/chrome/places/places.properties b/toolkit/locales/en-US/chrome/places/places.properties
index f9edeeff0..5c0134180 100644
--- a/toolkit/locales/en-US/chrome/places/places.properties
+++ b/toolkit/locales/en-US/chrome/places/places.properties
@@ -4,6 +4,7 @@
BookmarksMenuFolderTitle=Bookmarks Menu
BookmarksToolbarFolderTitle=Bookmarks Toolbar
+UnsortedBookmarksFolderTitle=Unsorted Bookmarks
OtherBookmarksFolderTitle=Other Bookmarks
TagsFolderTitle=Tags
MobileBookmarksFolderTitle=Mobile Bookmarks
diff --git a/toolkit/locales/jar.mn b/toolkit/locales/jar.mn
index e49e978f5..abc96086f 100644
--- a/toolkit/locales/jar.mn
+++ b/toolkit/locales/jar.mn
@@ -39,6 +39,7 @@
locale/@AB_CD@/global/customizeToolbar.dtd (%chrome/global/customizeToolbar.dtd)
locale/@AB_CD@/global/customizeToolbar.properties (%chrome/global/customizeToolbar.properties)
#endif
+ locale/@AB_CD@/global/datetimebox.dtd (%chrome/global/datetimebox.dtd)
locale/@AB_CD@/global/datetimepicker.dtd (%chrome/global/datetimepicker.dtd)
locale/@AB_CD@/global/dateFormat.properties (%chrome/global/dateFormat.properties)
locale/@AB_CD@/global/dialogOverlay.dtd (%chrome/global/dialogOverlay.dtd)
diff --git a/toolkit/locales/l10n.mk b/toolkit/locales/l10n.mk
index 34d78d33c..05bda0b56 100644
--- a/toolkit/locales/l10n.mk
+++ b/toolkit/locales/l10n.mk
@@ -120,14 +120,6 @@ ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
ifneq (en,$(LPROJ_ROOT))
mv $(STAGEDIST)/en.lproj $(STAGEDIST)/$(LPROJ_ROOT).lproj
endif
-ifdef MOZ_CRASHREPORTER
-# On Mac OS X, the crashreporter.ini file needs to be moved from under the
-# application bundle's Resources directory where all other l10n files are
-# located to the crash reporter bundle's Resources directory.
- mv $(STAGEDIST)/crashreporter.app/Contents/Resources/crashreporter.ini \
- $(STAGEDIST)/../MacOS/crashreporter.app/Contents/Resources/crashreporter.ini
- $(RM) -rf $(STAGEDIST)/crashreporter.app
-endif
endif
$(NSINSTALL) -D $(DIST)/l10n-stage/$(PKG_PATH)
diff --git a/toolkit/modules/AppConstants.jsm b/toolkit/modules/AppConstants.jsm
index ba5d82c01..2b18f3c1a 100644
--- a/toolkit/modules/AppConstants.jsm
+++ b/toolkit/modules/AppConstants.jsm
@@ -36,11 +36,18 @@ this.AppConstants = Object.freeze({
false,
#endif
- // Official corresponds, roughly, to whether this build is performed
- // on Mozilla's continuous integration infrastructure. You should
+ // Official corresponds to whether this build is considered an
+ // official, branded release for the public. You should
// disable developer-only functionality when this flag is set.
+ // MOZILLA_OFFICIAL is deprecated but kept for extension compatibility.
MOZILLA_OFFICIAL:
-#ifdef MOZILLA_OFFICIAL
+#ifdef MC_OFFICIAL
+ true,
+#else
+ false,
+#endif
+ MC_OFFICIAL:
+#ifdef MC_OFFICIAL
true,
#else
false,
@@ -183,13 +190,6 @@ this.AppConstants = Object.freeze({
Services.vc.compare(platformVersion, version) <= 0;
},
- MOZ_CRASHREPORTER:
-#ifdef MOZ_CRASHREPORTER
- true,
-#else
- false,
-#endif
-
MOZ_VERIFY_MAR_SIGNATURE:
#ifdef MOZ_VERIFY_MAR_SIGNATURE
true,
diff --git a/toolkit/modules/DateTimePickerHelper.jsm b/toolkit/modules/DateTimePickerHelper.jsm
index 398687988..b509742b0 100644
--- a/toolkit/modules/DateTimePickerHelper.jsm
+++ b/toolkit/modules/DateTimePickerHelper.jsm
@@ -21,6 +21,7 @@ this.EXPORTED_SYMBOLS = [
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
+Cu.import("resource://gre/modules/Task.jsm");
/*
* DateTimePickerHelper receives message from content side (input box) and
@@ -63,9 +64,13 @@ this.DateTimePickerHelper = {
return;
}
this.picker.closePicker();
+ this.close();
break;
}
case "FormDateTime:UpdatePicker": {
+ if (!this.picker) {
+ return;
+ }
this.picker.setPopupValue(aMessage.data);
break;
}
@@ -87,6 +92,7 @@ this.DateTimePickerHelper = {
if (browser) {
browser.messageManager.sendAsyncMessage("FormDateTime:PickerClosed");
}
+ this.picker.closePicker();
this.close();
break;
}
@@ -97,18 +103,15 @@ this.DateTimePickerHelper = {
// Called when picker value has changed, notify input box about it.
updateInputBoxValue: function(aEvent) {
- // TODO: parse data based on input type.
- const { hour, minute } = aEvent.detail;
- debug("hour: " + hour + ", minute: " + minute);
let browser = this.weakBrowser ? this.weakBrowser.get() : null;
if (browser) {
browser.messageManager.sendAsyncMessage(
- "FormDateTime:PickerValueChanged", { hour, minute });
+ "FormDateTime:PickerValueChanged", aEvent.detail);
}
},
// Get picker from browser and show it anchored to the input box.
- showPicker: function(aBrowser, aData) {
+ showPicker: Task.async(function* (aBrowser, aData) {
let rect = aData.rect;
let dir = aData.dir;
let type = aData.type;
@@ -138,13 +141,23 @@ this.DateTimePickerHelper = {
debug("aBrowser.dateTimePicker not found, exiting now.");
return;
}
- this.picker.loadPicker(type, detail);
+ // The datetimepopup binding is only attached when it is needed.
+ // Check if openPicker method is present to determine if binding has
+ // been attached. If not, attach the binding first before calling it.
+ if (!this.picker.openPicker) {
+ let bindingPromise = new Promise(resolve => {
+ this.picker.addEventListener("DateTimePickerBindingReady",
+ resolve, {once: true});
+ });
+ this.picker.setAttribute("active", true);
+ yield bindingPromise;
+ }
// The arrow panel needs an anchor to work. The popupAnchor (this._anchor)
// is a transparent div that the arrow can point to.
- this.picker.openPopup(this._anchor, "after_start", rect.left, rect.top);
+ this.picker.openPicker(type, this._anchor, detail);
this.addPickerListeners();
- },
+ }),
// Picker is closed, do some cleanup.
close: function() {
diff --git a/toolkit/modules/ResetProfile.jsm b/toolkit/modules/ResetProfile.jsm
index fe0d1cfe8..c1839af4f 100644
--- a/toolkit/modules/ResetProfile.jsm
+++ b/toolkit/modules/ResetProfile.jsm
@@ -11,7 +11,11 @@ const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/AppConstants.jsm");
-const MOZ_APP_NAME = AppConstants.MOZ_APP_NAME;
+// For Basilisk and Pale Moon
+// Hard-code MOZ_APP_NAME to firefox because of hard-coded type in migrator.
+const MOZ_APP_NAME = (((AppConstants.MOZ_APP_NAME == "basilisk")
+ || (AppConstants.MOZ_APP_NAME == "palemoon"))
+ ? "firefox" : AppConstants.MOZ_APP_NAME);
const MOZ_BUILD_APP = AppConstants.MOZ_BUILD_APP;
this.ResetProfile = {
diff --git a/toolkit/modules/Services.jsm b/toolkit/modules/Services.jsm
index 1bf1a89fe..58d87ffb1 100644
--- a/toolkit/modules/Services.jsm
+++ b/toolkit/modules/Services.jsm
@@ -39,15 +39,6 @@ XPCOMUtils.defineLazyGetter(Services, "dirsvc", function () {
.QueryInterface(Ci.nsIProperties);
});
-#ifdef MOZ_CRASHREPORTER
-XPCOMUtils.defineLazyGetter(Services, "crashmanager", () => {
- let ns = {};
- Components.utils.import("resource://gre/modules/CrashManager.jsm", ns);
-
- return ns.CrashManager.Singleton;
-});
-#endif
-
XPCOMUtils.defineLazyGetter(Services, "mm", () => {
return Cc["@mozilla.org/globalmessagemanager;1"]
.getService(Ci.nsIMessageBroadcaster)
diff --git a/toolkit/modules/Troubleshoot.jsm b/toolkit/modules/Troubleshoot.jsm
index cc545b4c4..60f7e8666 100644
--- a/toolkit/modules/Troubleshoot.jsm
+++ b/toolkit/modules/Troubleshoot.jsm
@@ -12,13 +12,6 @@ Cu.import("resource://gre/modules/AddonManager.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/AppConstants.jsm");
-var Experiments;
-try {
- Experiments = Cu.import("resource:///modules/experiments/Experiments.jsm").Experiments;
-}
-catch (e) {
-}
-
// We use a preferences whitelist to make sure we only show preferences that
// are useful for support and won't compromise the user's privacy. Note that
// entries are *prefixes*: for example, "accessibility." applies to all prefs
@@ -263,18 +256,6 @@ var dataProviders = {
});
},
- experiments: function experiments(done) {
- if (Experiments === undefined) {
- done([]);
- return;
- }
-
- // getExperiments promises experiment history
- Experiments.instance().getExperiments().then(
- experiments => done(experiments)
- );
- },
-
modifiedPreferences: function modifiedPreferences(done) {
done(getPrefList(name => Services.prefs.prefHasUserValue(name)));
},
@@ -549,19 +530,6 @@ var dataProviders = {
}
};
-if (AppConstants.MOZ_CRASHREPORTER) {
- dataProviders.crashes = function crashes(done) {
- let CrashReports = Cu.import("resource://gre/modules/CrashReports.jsm").CrashReports;
- let reports = CrashReports.getReports();
- let now = new Date();
- let reportsNew = reports.filter(report => (now - report.date < Troubleshoot.kMaxCrashAge));
- let reportsSubmitted = reportsNew.filter(report => (!report.pending));
- let reportsPendingCount = reportsNew.length - reportsSubmitted.length;
- let data = {submitted : reportsSubmitted, pending : reportsPendingCount};
- done(data);
- }
-}
-
if (AppConstants.MOZ_SANDBOX) {
dataProviders.sandbox = function sandbox(done) {
let data = {};
diff --git a/toolkit/modules/addons/WebRequestContent.js b/toolkit/modules/addons/WebRequestContent.js
index 219675e5b..f044a1cd4 100644
--- a/toolkit/modules/addons/WebRequestContent.js
+++ b/toolkit/modules/addons/WebRequestContent.js
@@ -80,6 +80,16 @@ var ContentPolicy = {
shouldLoad(policyType, contentLocation, requestOrigin,
node, mimeTypeGuess, extra, requestPrincipal) {
+
+ // Loads of TYPE_DOCUMENT and TYPE_SUBDOCUMENT perform a ConPol check
+ // within docshell as well as within the ContentSecurityManager. To avoid
+ // duplicate evaluations we ignore ConPol checks performed within docShell.
+ if (extra instanceof Ci.nsISupportsString) {
+ if (extra.data === "conPolCheckFromDocShell") {
+ return Ci.nsIContentPolicy.ACCEPT;
+ }
+ }
+
if (requestPrincipal &&
Services.scriptSecurityManager.isSystemPrincipal(requestPrincipal)) {
return Ci.nsIContentPolicy.ACCEPT;
diff --git a/toolkit/modules/sessionstore/FormData.jsm b/toolkit/modules/sessionstore/FormData.jsm
index f90ba5825..d4fb08d93 100644
--- a/toolkit/modules/sessionstore/FormData.jsm
+++ b/toolkit/modules/sessionstore/FormData.jsm
@@ -216,7 +216,7 @@ var FormDataInternal = {
// We want to avoid saving data for about:sessionrestore as a string.
// Since it's stored in the form as stringified JSON, stringifying further
// causes an explosion of escape characters. cf. bug 467409
- if (isRestorationPage(ret.url)) {
+ if (isRestorationPage(ret.url) && ret.id && ret.id.sessionData) {
ret.id.sessionData = JSON.parse(ret.id.sessionData);
}
diff --git a/toolkit/moz.build b/toolkit/moz.build
index d9becc9c6..778f1c0de 100644
--- a/toolkit/moz.build
+++ b/toolkit/moz.build
@@ -54,9 +54,6 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android':
DIRS += ['system/androidproxy']
-if CONFIG['MOZ_CRASHREPORTER']:
- DIRS += ['crashreporter']
-
TEST_HARNESS_FILES.testing.mochitest.browser.toolkit.crashreporter.test.browser += [
'crashreporter/test/browser/crashreport.sjs',
]
diff --git a/toolkit/moz.configure b/toolkit/moz.configure
index 4717af022..c1e0880c9 100644
--- a/toolkit/moz.configure
+++ b/toolkit/moz.configure
@@ -444,34 +444,10 @@ def omnijar_name(toolkit):
set_config('OMNIJAR_NAME', omnijar_name)
-project_flag('MOZ_PLACES',
- help='Build Places if required',
- set_as_define=True)
-
-project_flag('MOZ_SOCIAL',
- help='Build SocialAPI if required',
- default=True)
-
-project_flag('MOZ_SERVICES_HEALTHREPORT',
- help='Build Firefox Health Reporter Service',
- set_for_old_configure=True,
- set_as_define=True)
-
-project_flag('MOZ_SERVICES_SYNC',
- help='Build Sync Services if required')
-
-project_flag('MOZ_SERVICES_CLOUDSYNC',
- help='Build Services/CloudSync if required')
-
project_flag('MOZ_ANDROID_HISTORY',
help='Enable Android History instead of Places',
set_as_define=True)
-@depends('MOZ_PLACES', 'MOZ_ANDROID_HISTORY')
-def check_places_and_android_history(places, android_history):
- if places and android_history:
- die('Cannot use MOZ_ANDROID_HISTORY alongside MOZ_PLACES.')
-
# Permissions system
# ==============================================================
option(name='--disable-permissions',
diff --git a/toolkit/mozapps/extensions/AddonManager.jsm b/toolkit/mozapps/extensions/AddonManager.jsm
index 681c4240a..3913c2088 100644
--- a/toolkit/mozapps/extensions/AddonManager.jsm
+++ b/toolkit/mozapps/extensions/AddonManager.jsm
@@ -88,9 +88,9 @@ Cu.import("resource://gre/modules/Log.jsm");
// Configure a logger at the parent 'addons' level to format
// messages for all the modules under addons.*
const PARENT_LOGGER_ID = "addons";
-let parentLogger = Log.repository.getLogger(PARENT_LOGGER_ID);
+var parentLogger = Log.repository.getLogger(PARENT_LOGGER_ID);
parentLogger.level = Log.Level.Warn;
-let formatter = new Log.BasicFormatter();
+var formatter = new Log.BasicFormatter();
// Set parent logger (and its children) to append to
// the Javascript section of the Browser Console
parentLogger.addAppender(new Log.ConsoleAppender(formatter));
@@ -101,7 +101,7 @@ parentLogger.addAppender(new Log.DumpAppender(formatter));
// Create a new logger (child of 'addons' logger)
// for use by the Addons Manager
const LOGGER_ID = "addons.manager";
-let logger = Log.repository.getLogger(LOGGER_ID);
+var logger = Log.repository.getLogger(LOGGER_ID);
// Provide the ability to enable/disable logging
// messages at runtime.
diff --git a/toolkit/mozapps/extensions/AddonPathService.cpp b/toolkit/mozapps/extensions/AddonPathService.cpp
index 006149100..ddfdbe817 100644
--- a/toolkit/mozapps/extensions/AddonPathService.cpp
+++ b/toolkit/mozapps/extensions/AddonPathService.cpp
@@ -128,6 +128,16 @@ AddonPathService::InsertPath(const nsAString& path, const nsAString& addonIdStri
return NS_OK;
}
+NS_IMETHODIMP
+AddonPathService::MapURIToAddonId(nsIURI* aURI, nsAString& addonIdString)
+{
+ if (JSAddonId* id = MapURIToAddonID(aURI)) {
+ JSFlatString* flat = JS_ASSERT_STRING_IS_FLAT(JS::StringOfAddonId(id));
+ AssignJSFlatString(addonIdString, flat);
+ }
+ return NS_OK;
+}
+
static nsresult
ResolveURI(nsIURI* aURI, nsAString& out)
{
diff --git a/toolkit/mozapps/extensions/DeferredSave.jsm b/toolkit/mozapps/extensions/DeferredSave.jsm
index d7f5b8864..7587ce83b 100644
--- a/toolkit/mozapps/extensions/DeferredSave.jsm
+++ b/toolkit/mozapps/extensions/DeferredSave.jsm
@@ -12,7 +12,7 @@ Cu.import("resource://gre/modules/osfile.jsm");
Cu.import("resource://gre/modules/Promise.jsm");
// Make it possible to mock out timers for testing
-let MakeTimer = () => Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
+var MakeTimer = () => Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
this.EXPORTED_SYMBOLS = ["DeferredSave"];
@@ -23,9 +23,9 @@ Cu.import("resource://gre/modules/Log.jsm");
//Configure a logger at the parent 'DeferredSave' level to format
//messages for all the modules under DeferredSave.*
const DEFERREDSAVE_PARENT_LOGGER_ID = "DeferredSave";
-let parentLogger = Log.repository.getLogger(DEFERREDSAVE_PARENT_LOGGER_ID);
+var parentLogger = Log.repository.getLogger(DEFERREDSAVE_PARENT_LOGGER_ID);
parentLogger.level = Log.Level.Warn;
-let formatter = new Log.BasicFormatter();
+var formatter = new Log.BasicFormatter();
//Set parent logger (and its children) to append to
//the Javascript section of the Browser Console
parentLogger.addAppender(new Log.ConsoleAppender(formatter));
diff --git a/toolkit/mozapps/extensions/addonManager.js b/toolkit/mozapps/extensions/addonManager.js
index 862b1ea69..731e70c6c 100644
--- a/toolkit/mozapps/extensions/addonManager.js
+++ b/toolkit/mozapps/extensions/addonManager.js
@@ -31,9 +31,9 @@ const CHILD_SCRIPT = "resource://gre/modules/addons/Content.js";
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
-let gSingleton = null;
+var gSingleton = null;
-let gParentMM = null;
+var gParentMM = null;
function amManager() {
diff --git a/toolkit/mozapps/extensions/amIAddonPathService.idl b/toolkit/mozapps/extensions/amIAddonPathService.idl
index 863689858..9c9197a61 100644
--- a/toolkit/mozapps/extensions/amIAddonPathService.idl
+++ b/toolkit/mozapps/extensions/amIAddonPathService.idl
@@ -5,6 +5,8 @@
#include "nsISupports.idl"
+interface nsIURI;
+
/**
* This service maps file system paths where add-ons reside to the ID
* of the add-on. Paths are added by the add-on manager. They can
@@ -26,4 +28,10 @@ interface amIAddonPathService : nsISupports
* associated with the given add-on ID.
*/
void insertPath(in AString path, in AString addonId);
+
+ /**
+ * Given a URI to a file, return the ID of the add-on that the file belongs
+ * to. Returns an empty string if there is no add-on there.
+ */
+ AString mapURIToAddonId(in nsIURI aURI);
};
diff --git a/toolkit/mozapps/extensions/amInstallTrigger.js b/toolkit/mozapps/extensions/amInstallTrigger.js
index b83cbe60b..a18fe84c4 100644
--- a/toolkit/mozapps/extensions/amInstallTrigger.js
+++ b/toolkit/mozapps/extensions/amInstallTrigger.js
@@ -18,7 +18,7 @@ const MSG_INSTALL_ADDONS = "WebInstallerInstallAddonsFromWebpage";
const MSG_INSTALL_CALLBACK = "WebInstallerInstallCallback";
-let log = Log.repository.getLogger("AddonManager.InstallTrigger");
+var log = Log.repository.getLogger("AddonManager.InstallTrigger");
log.level = Log.Level[Preferences.get("extensions.logging.enabled", false) ? "Warn" : "Trace"];
function CallbackObject(id, callback, urls, mediator) {
diff --git a/toolkit/mozapps/extensions/amWebInstallListener.js b/toolkit/mozapps/extensions/amWebInstallListener.js
index 901beef07..ac6e2495d 100644
--- a/toolkit/mozapps/extensions/amWebInstallListener.js
+++ b/toolkit/mozapps/extensions/amWebInstallListener.js
@@ -37,7 +37,7 @@ const LOGGER_ID = "addons.weblistener";
// Create a new logger for use by the Addons Web Listener
// (Requires AddonManager.jsm)
-let logger = Log.repository.getLogger(LOGGER_ID);
+var logger = Log.repository.getLogger(LOGGER_ID);
function notifyObservers(aTopic, aBrowser, aUri, aInstalls) {
let info = {
diff --git a/toolkit/mozapps/extensions/content/extensions.js b/toolkit/mozapps/extensions/content/extensions.js
index a799eeebb..8d9c132e6 100644
--- a/toolkit/mozapps/extensions/content/extensions.js
+++ b/toolkit/mozapps/extensions/content/extensions.js
@@ -19,11 +19,9 @@ XPCOMUtils.defineLazyModuleGetter(this, "PluralForm",
"resource://gre/modules/PluralForm.jsm");
XPCOMUtils.defineLazyGetter(this, "BrowserToolboxProcess", function () {
- return Cu.import("resource://gre/modules/devtools/ToolboxProcess.jsm", {}).
+ return Cu.import("resource://devtools/client/framework/ToolboxProcess.jsm", {}).
BrowserToolboxProcess;
});
-XPCOMUtils.defineLazyModuleGetter(this, "Experiments",
- "resource:///modules/experiments/Experiments.jsm");
const PREF_DISCOVERURL = "extensions.webservice.discoverURL";
const PREF_DISCOVER_ENABLED = "extensions.getAddons.showPane";
@@ -216,23 +214,6 @@ function isDiscoverEnabled() {
return true;
}
-function getExperimentEndDate(aAddon) {
- if (!("@mozilla.org/browser/experiments-service;1" in Cc)) {
- return 0;
- }
-
- if (!aAddon.isActive) {
- return aAddon.endDate;
- }
-
- let experiment = Experiments.instance().getActiveExperiment();
- if (!experiment) {
- return 0;
- }
-
- return experiment.endDate;
-}
-
/**
* Obtain the main DOMWindow for the current context.
*/
@@ -1316,28 +1297,7 @@ var gViewController = {
doCommand: function cmd_neverActivateItem_doCommand(aAddon) {
aAddon.userDisabled = true;
}
- },
-
- cmd_experimentsLearnMore: {
- isEnabled: function cmd_experimentsLearnMore_isEnabled() {
- let mainWindow = getMainWindow();
- return mainWindow && "switchToTabHavingURI" in mainWindow;
- },
- doCommand: function cmd_experimentsLearnMore_doCommand() {
- let url = Services.prefs.getCharPref("toolkit.telemetry.infoURL");
- openOptionsInTab(url);
- },
- },
-
- cmd_experimentsOpenTelemetryPreferences: {
- isEnabled: function cmd_experimentsOpenTelemetryPreferences_isEnabled() {
- return !!getMainWindowWithPreferencesPane();
- },
- doCommand: function cmd_experimentsOpenTelemetryPreferences_doCommand() {
- let mainWindow = getMainWindowWithPreferencesPane();
- mainWindow.openAdvancedPreferences("dataChoicesTab");
- },
- },
+ }
},
supportsCommand: function gVC_supportsCommand(aCommand) {
@@ -1468,10 +1428,6 @@ function createItem(aObj, aIsInstall, aIsRemote) {
// the binding handles the rest
item.setAttribute("value", aObj.id);
- if (aObj.type == "experiment") {
- item.endDate = getExperimentEndDate(aObj);
- }
-
return item;
}
@@ -2500,7 +2456,7 @@ var gSearchView = {
this._allResultsLink.setAttribute("href",
AddonRepository.getSearchURL(this._lastQuery));
this._allResultsLink.hidden = false;
- },
+ },
updateListAttributes: function gSearchView_updateListAttributes() {
var item = this._listBox.querySelector("richlistitem[remote='true'][first]");
@@ -2679,13 +2635,6 @@ var gListView = {
// the existing item
if (aInstall.existingAddon)
this.removeItem(aInstall, true);
-
- if (aInstall.addon.type == "experiment") {
- let item = this.getListItemForID(aInstall.addon.id);
- if (item) {
- item.endDate = getExperimentEndDate(aInstall.addon);
- }
- }
},
addItem: function gListView_addItem(aObj, aIsInstall) {
@@ -2945,34 +2894,6 @@ var gDetailView = {
}
}
- if (this._addon.type == "experiment") {
- let prefix = "details.experiment.";
- let active = this._addon.isActive;
-
- let stateKey = prefix + "state." + (active ? "active" : "complete");
- let node = document.getElementById("detail-experiment-state");
- node.value = gStrings.ext.GetStringFromName(stateKey);
-
- let now = Date.now();
- let end = getExperimentEndDate(this._addon);
- let days = Math.abs(end - now) / (24 * 60 * 60 * 1000);
-
- let timeKey = prefix + "time.";
- let timeMessage;
- if (days < 1) {
- timeKey += (active ? "endsToday" : "endedToday");
- timeMessage = gStrings.ext.GetStringFromName(timeKey);
- } else {
- timeKey += (active ? "daysRemaining" : "daysPassed");
- days = Math.round(days);
- let timeString = gStrings.ext.GetStringFromName(timeKey);
- timeMessage = PluralForm.get(days, timeString)
- .replace("#1", days);
- }
-
- document.getElementById("detail-experiment-time").value = timeMessage;
- }
-
this.fillSettingsRows(aScrollToPreferences, (function updateView_fillSettingsRows() {
this.updateState();
gViewController.notifyViewChanged();
diff --git a/toolkit/mozapps/extensions/content/update.js b/toolkit/mozapps/extensions/content/update.js
index 3d87f4d4b..afc74dca8 100644
--- a/toolkit/mozapps/extensions/content/update.js
+++ b/toolkit/mozapps/extensions/content/update.js
@@ -22,7 +22,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "AddonRepository", "resource://gre/modul
XPCOMUtils.defineLazyModuleGetter(this, "Task", "resource://gre/modules/Task.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Promise", "resource://gre/modules/Promise.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Log", "resource://gre/modules/Log.jsm");
-let logger = null;
+var logger = null;
var gUpdateWizard = {
// When synchronizing app compatibility info this contains all installed
@@ -169,7 +169,7 @@ var gOfflinePage = {
}
// Addon listener to count addons enabled/disabled by metadata checks
-let listener = {
+var listener = {
onDisabled: function listener_onDisabled(aAddon) {
gUpdateWizard.affectedAddonIDs.add(aAddon.id);
gUpdateWizard.metadataDisabled++;
diff --git a/toolkit/mozapps/extensions/internal/AddonRepository.jsm b/toolkit/mozapps/extensions/internal/AddonRepository.jsm
index adcecbee7..76a7528c7 100644
--- a/toolkit/mozapps/extensions/internal/AddonRepository.jsm
+++ b/toolkit/mozapps/extensions/internal/AddonRepository.jsm
@@ -72,7 +72,7 @@ const LOGGER_ID = "addons.repository";
// Create a new logger for use by the Addons Repository
// (Requires AddonManager.jsm)
-let logger = Log.repository.getLogger(LOGGER_ID);
+var logger = Log.repository.getLogger(LOGGER_ID);
// A map between XML keys to AddonSearchResult keys for string values
// that require no extra parsing from XML
@@ -101,7 +101,7 @@ const INTEGER_KEY_MAP = {
};
// Wrap the XHR factory so that tests can override with a mock
-let XHRequest = Components.Constructor("@mozilla.org/xmlextras/xmlhttprequest;1",
+var XHRequest = Components.Constructor("@mozilla.org/xmlextras/xmlhttprequest;1",
"nsIXMLHttpRequest");
function convertHTMLToPlainText(html) {
diff --git a/toolkit/mozapps/extensions/internal/AddonRepository_SQLiteMigrator.jsm b/toolkit/mozapps/extensions/internal/AddonRepository_SQLiteMigrator.jsm
index 128146bbe..66147b9aa 100644
--- a/toolkit/mozapps/extensions/internal/AddonRepository_SQLiteMigrator.jsm
+++ b/toolkit/mozapps/extensions/internal/AddonRepository_SQLiteMigrator.jsm
@@ -30,7 +30,7 @@ const LOGGER_ID = "addons.repository.sqlmigrator";
// Create a new logger for use by the Addons Repository SQL Migrator
// (Requires AddonManager.jsm)
-let logger = Log.repository.getLogger(LOGGER_ID);
+var logger = Log.repository.getLogger(LOGGER_ID);
this.EXPORTED_SYMBOLS = ["AddonRepository_SQLiteMigrator"];
@@ -60,7 +60,11 @@ this.AddonRepository_SQLiteMigrator = {
this._retrieveStoredData((results) => {
this._closeConnection();
- let resultArray = [addon for ([,addon] of Iterator(results))];
+ // Tycho: let resultArray = [addon for ([,addon] of Iterator(results))];
+ let resultArray = [];
+ for (let [,addon] of Iterator(results)) {
+ resultArray.push(addon);
+ }
logger.debug(resultArray.length + " addons imported.")
aCallback(resultArray);
});
diff --git a/toolkit/mozapps/extensions/internal/AddonUpdateChecker.jsm b/toolkit/mozapps/extensions/internal/AddonUpdateChecker.jsm
index d68a0f175..939e2e269 100644
--- a/toolkit/mozapps/extensions/internal/AddonUpdateChecker.jsm
+++ b/toolkit/mozapps/extensions/internal/AddonUpdateChecker.jsm
@@ -52,7 +52,7 @@ const LOGGER_ID = "addons.update-checker";
// Create a new logger for use by the Addons Update Checker
// (Requires AddonManager.jsm)
-let logger = Log.repository.getLogger(LOGGER_ID);
+var logger = Log.repository.getLogger(LOGGER_ID);
/**
* A serialisation method for RDF data that produces an identical string
diff --git a/toolkit/mozapps/extensions/internal/Content.js b/toolkit/mozapps/extensions/internal/Content.js
index 29c0ed8ce..61a8b0323 100644
--- a/toolkit/mozapps/extensions/internal/Content.js
+++ b/toolkit/mozapps/extensions/internal/Content.js
@@ -8,9 +8,9 @@
const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
-let {Services} = Cu.import("resource://gre/modules/Services.jsm", {});
+var {Services} = Cu.import("resource://gre/modules/Services.jsm", {});
-let nsIFile = Components.Constructor("@mozilla.org/file/local;1", "nsIFile",
+var nsIFile = Components.Constructor("@mozilla.org/file/local;1", "nsIFile",
"initWithPath");
const MSG_JAR_FLUSH = "AddonJarFlush";
diff --git a/toolkit/mozapps/extensions/internal/GMPProvider.jsm b/toolkit/mozapps/extensions/internal/GMPProvider.jsm
index a55457f6e..52affa9ba 100644
--- a/toolkit/mozapps/extensions/internal/GMPProvider.jsm
+++ b/toolkit/mozapps/extensions/internal/GMPProvider.jsm
@@ -64,11 +64,11 @@ XPCOMUtils.defineLazyGetter(this, "pluginsBundle",
XPCOMUtils.defineLazyGetter(this, "gmpService",
() => Cc["@mozilla.org/gecko-media-plugin-service;1"].getService(Ci.mozIGeckoMediaPluginChromeService));
-let messageManager = Cc["@mozilla.org/globalmessagemanager;1"]
+var messageManager = Cc["@mozilla.org/globalmessagemanager;1"]
.getService(Ci.nsIMessageListenerManager);
-let gLogger;
-let gLogAppenderDump = null;
+var gLogger;
+var gLogAppenderDump = null;
function configureLogging() {
if (!gLogger) {
@@ -443,7 +443,7 @@ GMPWrapper.prototype = {
},
};
-let GMPProvider = {
+var GMPProvider = {
get name() { return "GMPProvider"; },
_plugins: null,
diff --git a/toolkit/mozapps/extensions/internal/LightweightThemeImageOptimizer.jsm b/toolkit/mozapps/extensions/internal/LightweightThemeImageOptimizer.jsm
index fccde9a81..1e7d6b0d8 100644
--- a/toolkit/mozapps/extensions/internal/LightweightThemeImageOptimizer.jsm
+++ b/toolkit/mozapps/extensions/internal/LightweightThemeImageOptimizer.jsm
@@ -49,7 +49,7 @@ this.LightweightThemeImageOptimizer = {
Object.freeze(LightweightThemeImageOptimizer);
-let ImageCropper = {
+var ImageCropper = {
_inProgress: {},
getCroppedImageURL:
@@ -119,7 +119,7 @@ let ImageCropper = {
}
};
-let ImageFile = {
+var ImageFile = {
read: function ImageFile_read(aURI, aCallback) {
this._netUtil.asyncFetch2(
aURI,
@@ -158,7 +158,7 @@ let ImageFile = {
XPCOMUtils.defineLazyModuleGetter(ImageFile, "_netUtil",
"resource://gre/modules/NetUtil.jsm", "NetUtil");
-let ImageTools = {
+var ImageTools = {
decode: function ImageTools_decode(aInputStream, aContentType) {
let outParam = {value: null};
@@ -187,7 +187,7 @@ let ImageTools = {
XPCOMUtils.defineLazyServiceGetter(ImageTools, "_imgTools",
"@mozilla.org/image/tools;1", "imgITools");
-let Utils = {
+var Utils = {
createCopy: function Utils_createCopy(aData) {
let copy = {};
for (let [k, v] in Iterator(aData)) {
diff --git a/toolkit/mozapps/extensions/internal/PluginProvider.jsm b/toolkit/mozapps/extensions/internal/PluginProvider.jsm
index 04a4f9d7c..cb07dcb12 100644
--- a/toolkit/mozapps/extensions/internal/PluginProvider.jsm
+++ b/toolkit/mozapps/extensions/internal/PluginProvider.jsm
@@ -23,7 +23,7 @@ const LOGGER_ID = "addons.plugins";
// Create a new logger for use by the Addons Plugin Provider
// (Requires AddonManager.jsm)
-let logger = Log.repository.getLogger(LOGGER_ID);
+var logger = Log.repository.getLogger(LOGGER_ID);
function getIDHashForString(aStr) {
// return the two-digit hexadecimal code for a byte
diff --git a/toolkit/mozapps/extensions/internal/XPIProvider.jsm b/toolkit/mozapps/extensions/internal/XPIProvider.jsm
index 54b86edc4..8b49c6600 100644
--- a/toolkit/mozapps/extensions/internal/XPIProvider.jsm
+++ b/toolkit/mozapps/extensions/internal/XPIProvider.jsm
@@ -37,9 +37,9 @@ XPCOMUtils.defineLazyModuleGetter(this, "Task",
XPCOMUtils.defineLazyModuleGetter(this, "OS",
"resource://gre/modules/osfile.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "BrowserToolboxProcess",
- "resource://gre/modules/devtools/ToolboxProcess.jsm");
+ "resource://devtools/client/framework/ToolboxProcess.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "ConsoleAPI",
- "resource://gre/modules/devtools/Console.jsm");
+ "resource://gre/modules/Console.jsm");
XPCOMUtils.defineLazyServiceGetter(this, "Blocklist",
"@mozilla.org/extensions/blocklist;1",
@@ -52,6 +52,10 @@ XPCOMUtils.defineLazyServiceGetter(this,
"ResProtocolHandler",
"@mozilla.org/network/protocol;1?name=resource",
"nsIResProtocolHandler");
+XPCOMUtils.defineLazyServiceGetter(this,
+ "AddonPathService",
+ "@mozilla.org/addon-path-service;1",
+ "amIAddonPathService");
const nsIFile = Components.Constructor("@mozilla.org/file/local;1", "nsIFile",
"initWithPath");
@@ -129,7 +133,7 @@ const PREFIX_NS_EM = "http://www.mozilla.org/2004/em-rdf#";
const TOOLKIT_ID = "toolkit@mozilla.org";
#ifdef MOZ_PHOENIX_EXTENSIONS
const FIREFOX_ID = "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}"
-const FIREFOX_APPCOMPATVERSION = "27.9"
+const FIREFOX_APPCOMPATVERSION = "56.9"
#endif
// The value for this is in Makefile.in
@@ -222,7 +226,7 @@ const LOGGER_ID = "addons.xpi";
// Create a new logger for use by all objects in this Addons XPI Provider module
// (Requires AddonManager.jsm)
-let logger = Log.repository.getLogger(LOGGER_ID);
+var logger = Log.repository.getLogger(LOGGER_ID);
const LAZY_OBJECTS = ["XPIDatabase"];
@@ -1887,8 +1891,7 @@ this.XPIProvider = {
logger.info("Mapping " + aID + " to " + aFile.path);
this._addonFileMap.set(aID, aFile.path);
- let service = Cc["@mozilla.org/addon-path-service;1"].getService(Ci.amIAddonPathService);
- service.insertPath(aFile.path, aID);
+ AddonPathService.insertPath(aFile.path, aID);
},
/**
@@ -1931,12 +1934,10 @@ this.XPIProvider = {
let chan;
try {
- chan = Services.io.newChannelFromURI2(aURI,
- null, // aLoadingNode
- Services.scriptSecurityManager.getSystemPrincipal(),
- null, // aTriggeringPrincipal
- Ci.nsILoadInfo.SEC_NORMAL,
- Ci.nsIContentPolicy.TYPE_OTHER);
+ chan = NetUtil.newChannel({
+ uri: aURI,
+ loadUsingSystemPrincipal: true
+ });
}
catch (ex) {
return null;
@@ -2082,7 +2083,7 @@ this.XPIProvider = {
Services.prefs.addObserver(PREF_EM_MIN_COMPAT_APP_VERSION, this, false);
Services.prefs.addObserver(PREF_EM_MIN_COMPAT_PLATFORM_VERSION, this, false);
Services.obs.addObserver(this, NOTIFICATION_FLUSH_PERMISSIONS, false);
- if (Cu.isModuleLoaded("resource://gre/modules/devtools/ToolboxProcess.jsm")) {
+ if (Cu.isModuleLoaded("resource://devtools/client/framework/ToolboxProcess.jsm")) {
// If BrowserToolboxProcess is already loaded, set the boolean to true
// and do whatever is needed
this._toolboxProcessLoaded = true;
@@ -3918,16 +3919,8 @@ this.XPIProvider = {
* @see amIAddonManager.mapURIToAddonID
*/
mapURIToAddonID: function XPI_mapURIToAddonID(aURI) {
- let resolved = this._resolveURIToFile(aURI);
- if (!resolved || !(resolved instanceof Ci.nsIFileURL))
- return null;
-
- for (let [id, path] of this._addonFileMap) {
- if (resolved.file.path.startsWith(path))
- return id;
- }
-
- return null;
+ // Returns `null` instead of empty string if the URI can't be mapped.
+ return AddonPathService.mapURIToAddonId(aURI) || null;
},
/**
@@ -4438,7 +4431,18 @@ this.XPIProvider = {
if (aAddon.type == "locale")
return;
- if (!(aMethod in this.bootstrapScopes[aAddon.id])) {
+ let method = undefined;
+ try {
+ method = Components.utils.evalInSandbox(`${aMethod};`,
+ this.bootstrapScopes[aAddon.id],
+ "ECMAv5");
+ }
+ catch (e) {
+ // An exception will be caught if the expected method is not defined.
+ // That will be logged below.
+ }
+
+ if (!method) {
logger.warn("Add-on " + aAddon.id + " is missing bootstrap method " + aMethod);
return;
}
@@ -4457,9 +4461,9 @@ this.XPIProvider = {
}
logger.debug("Calling bootstrap method " + aMethod + " on " + aAddon.id + " version " +
- aAddon.version);
+ aAddon.version);
try {
- this.bootstrapScopes[aAddon.id][aMethod](params, aReason);
+ method(params, aReason);
}
catch (e) {
logger.warn("Exception running bootstrap method " + aMethod + " on " + aAddon.id, e);
@@ -5456,21 +5460,17 @@ AddonInstall.prototype = {
let requireBuiltIn = Preferences.get(PREF_INSTALL_REQUIREBUILTINCERTS, true);
this.badCertHandler = new BadCertHandler(!requireBuiltIn);
- this.channel = NetUtil.newChannel2(this.sourceURI,
- null,
- null,
- null, // aLoadingNode
- Services.scriptSecurityManager.getSystemPrincipal(),
- null, // aTriggeringPrincipal
- Ci.nsILoadInfo.SEC_NORMAL,
- Ci.nsIContentPolicy.TYPE_OTHER);
+ this.channel = NetUtil.newChannel({
+ uri: this.sourceURI,
+ loadUsingSystemPrincipal: true
+ });
this.channel.notificationCallbacks = this;
if (this.channel instanceof Ci.nsIHttpChannel) {
this.channel.setRequestHeader("Moz-XPI-Update", "1", true);
if (this.channel instanceof Ci.nsIHttpChannelInternal)
this.channel.forceAllowThirdPartyCookie = true;
}
- this.channel.asyncOpen(listener, null);
+ this.channel.asyncOpen2(listener);
Services.obs.addObserver(this, "network:offline-about-to-go-offline", false);
}
@@ -7822,7 +7822,7 @@ WinRegInstallLocation.prototype = {
};
#endif
-let addonTypes = [
+var addonTypes = [
new AddonManagerPrivate.AddonType("extension", URI_EXTENSION_STRINGS,
STRING_TYPE_NAME,
AddonManager.VIEW_TYPE_LIST, 4000,
diff --git a/toolkit/mozapps/extensions/internal/XPIProviderUtils.js b/toolkit/mozapps/extensions/internal/XPIProviderUtils.js
index 2cef907f1..d26029455 100644
--- a/toolkit/mozapps/extensions/internal/XPIProviderUtils.js
+++ b/toolkit/mozapps/extensions/internal/XPIProviderUtils.js
@@ -29,7 +29,7 @@ const LOGGER_ID = "addons.xpi-utils";
// Create a new logger for use by the Addons XPI Provider Utils
// (Requires AddonManager.jsm)
-let logger = Log.repository.getLogger(LOGGER_ID);
+var logger = Log.repository.getLogger(LOGGER_ID);
const KEY_PROFILEDIR = "ProfD";
const FILE_DATABASE = "extensions.sqlite";
diff --git a/toolkit/mozapps/extensions/nsBlocklistService.js b/toolkit/mozapps/extensions/nsBlocklistService.js
index 936c9d1b5..487dae8e5 100644
--- a/toolkit/mozapps/extensions/nsBlocklistService.js
+++ b/toolkit/mozapps/extensions/nsBlocklistService.js
@@ -910,7 +910,7 @@ Blocklist.prototype = {
let issuer = blocklistElement.getAttribute("issuerName");
for (let snElement of blocklistElement.children) {
try {
- gCertBlocklistService.addRevokedCert(issuer, snElement.textContent);
+ gCertBlocklistService.revokeCertByIssuerAndSerial(issuer, snElement.textContent);
} catch (e) {
// we want to keep trying other elements since missing all items
// is worse than missing one
diff --git a/toolkit/mozapps/extensions/test/addons/test_bootstrap_const/bootstrap.js b/toolkit/mozapps/extensions/test/addons/test_bootstrap_const/bootstrap.js
new file mode 100644
index 000000000..498b76526
--- /dev/null
+++ b/toolkit/mozapps/extensions/test/addons/test_bootstrap_const/bootstrap.js
@@ -0,0 +1,5 @@
+Components.utils.import("resource://gre/modules/Services.jsm");
+
+const install = function() {
+ Services.obs.notifyObservers(null, "addon-install", "");
+} \ No newline at end of file
diff --git a/toolkit/mozapps/extensions/test/addons/test_bootstrap_const/install.rdf b/toolkit/mozapps/extensions/test/addons/test_bootstrap_const/install.rdf
new file mode 100644
index 000000000..af3a749ce
--- /dev/null
+++ b/toolkit/mozapps/extensions/test/addons/test_bootstrap_const/install.rdf
@@ -0,0 +1,24 @@
+<?xml version="1.0"?>
+
+<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:em="http://www.mozilla.org/2004/em-rdf#">
+
+ <Description about="urn:mozilla:install-manifest">
+ <em:id>bootstrap@tests.mozilla.org</em:id>
+ <em:version>1.0</em:version>
+ <em:bootstrap>true</em:bootstrap>
+
+ <!-- Front End MetaData -->
+ <em:name>Test Bootstrap</em:name>
+ <em:description>Test Description</em:description>
+
+ <em:targetApplication>
+ <Description>
+ <em:id>xpcshell@tests.mozilla.org</em:id>
+ <em:minVersion>1</em:minVersion>
+ <em:maxVersion>1</em:maxVersion>
+ </Description>
+ </em:targetApplication>
+
+ </Description>
+</RDF> \ No newline at end of file
diff --git a/toolkit/mozapps/extensions/test/browser/browser-common.ini b/toolkit/mozapps/extensions/test/browser/browser-common.ini
index eaab29f75..3e88833ef 100644
--- a/toolkit/mozapps/extensions/test/browser/browser-common.ini
+++ b/toolkit/mozapps/extensions/test/browser/browser-common.ini
@@ -39,8 +39,6 @@ skip-if = true # Bug 1093190 - Disabled due to leak
[browser_discovery.js]
skip-if = e10s # Bug ?????? - test times out on try on all platforms, but works locally for markh!
[browser_dragdrop.js]
-skip-if = buildapp == 'mulet'
-[browser_experiments.js]
skip-if = e10s
[browser_list.js]
[browser_metadataTimeout.js]
diff --git a/toolkit/mozapps/extensions/test/browser/browser_experiments.js b/toolkit/mozapps/extensions/test/browser/browser_experiments.js
deleted file mode 100644
index 72d0ca83e..000000000
--- a/toolkit/mozapps/extensions/test/browser/browser_experiments.js
+++ /dev/null
@@ -1,645 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-Components.utils.import("resource://gre/modules/Promise.jsm", this);
-
-let {AddonTestUtils} = Components.utils.import("resource://testing-common/AddonManagerTesting.jsm", {});
-let {HttpServer} = Components.utils.import("resource://testing-common/httpd.js", {});
-
-let gManagerWindow;
-let gCategoryUtilities;
-let gExperiments;
-let gHttpServer;
-
-let gSavedManifestURI;
-let gIsEnUsLocale;
-
-const SEC_IN_ONE_DAY = 24 * 60 * 60;
-const MS_IN_ONE_DAY = SEC_IN_ONE_DAY * 1000;
-
-function getExperimentAddons() {
- let deferred = Promise.defer();
- AddonManager.getAddonsByTypes(["experiment"], (addons) => {
- deferred.resolve(addons);
- });
- return deferred.promise;
-}
-
-function getInstallItem() {
- let doc = gManagerWindow.document;
- let view = doc.getElementById("view-port").selectedPanel;
- let list = doc.getElementById("addon-list");
-
- let node = list.firstChild;
- while (node) {
- if (node.getAttribute("status") == "installing") {
- return node;
- }
- node = node.nextSibling;
- }
-
- return null;
-}
-
-function patchPolicy(policy, data) {
- for (let key of Object.keys(data)) {
- Object.defineProperty(policy, key, {
- value: data[key],
- writable: true,
- });
- }
-}
-
-function defineNow(policy, time) {
- patchPolicy(policy, { now: () => new Date(time) });
-}
-
-function openDetailsView(aId) {
- let item = get_addon_element(gManagerWindow, aId);
- Assert.ok(item, "Should have got add-on element.");
- is_element_visible(item, "Add-on element should be visible.");
-
- EventUtils.synthesizeMouseAtCenter(item, { clickCount: 1 }, gManagerWindow);
- EventUtils.synthesizeMouseAtCenter(item, { clickCount: 2 }, gManagerWindow);
-
- let deferred = Promise.defer();
- wait_for_view_load(gManagerWindow, deferred.resolve);
- return deferred.promise;
-}
-
-function clickRemoveButton(addonElement) {
- let btn = gManagerWindow.document.getAnonymousElementByAttribute(addonElement, "anonid", "remove-btn");
- if (!btn) {
- return Promise.reject();
- }
-
- EventUtils.synthesizeMouseAtCenter(btn, { clickCount: 1 }, gManagerWindow);
- let deferred = Promise.defer();
- setTimeout(deferred.resolve, 0);
- return deferred;
-}
-
-function clickUndoButton(addonElement) {
- let btn = gManagerWindow.document.getAnonymousElementByAttribute(addonElement, "anonid", "undo-btn");
- if (!btn) {
- return Promise.reject();
- }
-
- EventUtils.synthesizeMouseAtCenter(btn, { clickCount: 1 }, gManagerWindow);
- let deferred = Promise.defer();
- setTimeout(deferred.resolve, 0);
- return deferred;
-}
-
-add_task(function* initializeState() {
- gManagerWindow = yield open_manager();
- gCategoryUtilities = new CategoryUtilities(gManagerWindow);
-
- registerCleanupFunction(() => {
- Services.prefs.clearUserPref("experiments.enabled");
- if (gHttpServer) {
- gHttpServer.stop(() => {});
- if (gSavedManifestURI !== undefined) {
- Services.prefs.setCharPref("experments.manifest.uri", gSavedManifestURI);
- }
- }
- if (gExperiments) {
- let tmp = {};
- Cu.import("resource:///modules/experiments/Experiments.jsm", tmp);
- gExperiments._policy = new tmp.Experiments.Policy();
- }
- });
-
- let chrome = Cc["@mozilla.org/chrome/chrome-registry;1"].getService(Ci.nsIXULChromeRegistry);
- gIsEnUsLocale = chrome.getSelectedLocale("global") == "en-US";
-
- // The Experiments Manager will interfere with us by preventing installs
- // of experiments it doesn't know about. We remove it from the equation
- // because here we are only concerned with core Addon Manager operation,
- // not the superset Experiments Manager has imposed.
- if ("@mozilla.org/browser/experiments-service;1" in Components.classes) {
- let tmp = {};
- Cu.import("resource:///modules/experiments/Experiments.jsm", tmp);
- // There is a race condition between XPCOM service initialization and
- // this test running. We have to initialize the instance first, then
- // uninitialize it to prevent this.
- gExperiments = tmp.Experiments.instance();
- yield gExperiments._mainTask;
- yield gExperiments.uninit();
- }
-});
-
-// On an empty profile with no experiments, the experiment category
-// should be hidden.
-add_task(function* testInitialState() {
- Assert.ok(gCategoryUtilities.get("experiment", false), "Experiment tab is defined.");
- Assert.ok(!gCategoryUtilities.isTypeVisible("experiment"), "Experiment tab hidden by default.");
-});
-
-add_task(function* testExperimentInfoNotVisible() {
- yield gCategoryUtilities.openType("extension");
- let el = gManagerWindow.document.getElementsByClassName("experiment-info-container")[0];
- is_element_hidden(el, "Experiment info not visible on other types.");
-});
-
-// If we have an active experiment, we should see the experiments tab
-// and that tab should have some messages.
-add_task(function* testActiveExperiment() {
- let addon = yield install_addon("addons/browser_experiment1.xpi");
-
- Assert.ok(addon.userDisabled, "Add-on is disabled upon initial install.");
- Assert.equal(addon.isActive, false, "Add-on is not active.");
-
- Assert.ok(gCategoryUtilities.isTypeVisible("experiment"), "Experiment tab visible.");
-
- yield gCategoryUtilities.openType("experiment");
- let el = gManagerWindow.document.getElementsByClassName("experiment-info-container")[0];
- is_element_visible(el, "Experiment info is visible on experiment tab.");
-});
-
-add_task(function* testExperimentLearnMore() {
- // Actual URL is irrelevant.
- Services.prefs.setCharPref("toolkit.telemetry.infoURL",
- "http://mochi.test:8888/server.js");
-
- yield gCategoryUtilities.openType("experiment");
- let btn = gManagerWindow.document.getElementById("experiments-learn-more");
-
- if (!gUseInContentUI) {
- is_element_hidden(btn, "Learn more button hidden if not using in-content UI.");
- Services.prefs.clearUserPref("toolkit.telemetry.infoURL");
-
- return;
- }
-
- is_element_visible(btn, "Learn more button visible.");
-
- let deferred = Promise.defer();
- window.addEventListener("DOMContentLoaded", function onLoad(event) {
- info("Telemetry privacy policy window opened.");
- window.removeEventListener("DOMContentLoaded", onLoad, false);
-
- let browser = gBrowser.selectedBrowser;
- let expected = Services.prefs.getCharPref("toolkit.telemetry.infoURL");
- Assert.equal(browser.currentURI.spec, expected, "New tab should have loaded privacy policy.");
- browser.contentWindow.close();
-
- Services.prefs.clearUserPref("toolkit.telemetry.infoURL");
-
- deferred.resolve();
- }, false);
-
- info("Opening telemetry privacy policy.");
- EventUtils.synthesizeMouseAtCenter(btn, {}, gManagerWindow);
-
- yield deferred.promise;
-});
-
-add_task(function* testOpenPreferences() {
- yield gCategoryUtilities.openType("experiment");
- let btn = gManagerWindow.document.getElementById("experiments-change-telemetry");
- if (!gUseInContentUI) {
- is_element_hidden(btn, "Change telemetry button not enabled in out of window UI.");
- info("Skipping preferences open test because not using in-content UI.");
- return;
- }
-
- is_element_visible(btn, "Change telemetry button visible in in-content UI.");
-
- let deferred = Promise.defer();
- Services.obs.addObserver(function observer(prefWin, topic, data) {
- Services.obs.removeObserver(observer, "advanced-pane-loaded");
- info("Advanced preference pane opened.");
- executeSoon(function() {
- // We want this test to fail if the preferences pane changes.
- let el = prefWin.document.getElementById("dataChoicesPanel");
- is_element_visible(el);
-
- prefWin.close();
- info("Closed preferences pane.");
-
- deferred.resolve();
- });
- }, "advanced-pane-loaded", false);
-
- info("Loading preferences pane.");
- EventUtils.synthesizeMouseAtCenter(btn, {}, gManagerWindow);
-
- yield deferred.promise;
-});
-
-add_task(function* testButtonPresence() {
- yield gCategoryUtilities.openType("experiment");
- let item = get_addon_element(gManagerWindow, "test-experiment1@experiments.mozilla.org");
- Assert.ok(item, "Got add-on element.");
- item.parentNode.ensureElementIsVisible(item);
-
- let el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "remove-btn");
- // Corresponds to the uninstall permission.
- is_element_visible(el, "Remove button is visible.");
- // Corresponds to lack of disable permission.
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "disable-btn");
- is_element_hidden(el, "Disable button not visible.");
- // Corresponds to lack of enable permission.
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "enable-btn");
- is_element_hidden(el, "Enable button not visible.");
-});
-
-// Remove the add-on we've been testing with.
-add_task(function* testCleanup() {
- yield AddonTestUtils.uninstallAddonByID("test-experiment1@experiments.mozilla.org");
- // Verify some conditions, just in case.
- let addons = yield getExperimentAddons();
- Assert.equal(addons.length, 0, "No experiment add-ons are installed.");
-});
-
-// The following tests should ideally live in browser/experiments/. However,
-// they rely on some of the helper functions from head.js, which can't easily
-// be consumed from other directories. So, they live here.
-
-add_task(function* testActivateExperiment() {
- if (!gExperiments) {
- info("Skipping experiments test because that feature isn't available.");
- return;
- }
-
- gHttpServer = new HttpServer();
- gHttpServer.start(-1);
- let root = "http://localhost:" + gHttpServer.identity.primaryPort + "/";
- gHttpServer.registerPathHandler("/manifest", (request, response) => {
- response.setStatusLine(null, 200, "OK");
- response.write(JSON.stringify({
- "version": 1,
- "experiments": [
- {
- id: "experiment-1",
- xpiURL: TESTROOT + "addons/browser_experiment1.xpi",
- xpiHash: "IRRELEVANT",
- startTime: Date.now() / 1000 - 3600,
- endTime: Date.now() / 1000 + 3600,
- maxActiveSeconds: 600,
- appName: [Services.appinfo.name],
- channel: [gExperiments._policy.updatechannel()],
- },
- ],
- }));
- response.processAsync();
- response.finish();
- });
-
- gSavedManifestURI = Services.prefs.getCharPref("experiments.manifest.uri");
- Services.prefs.setCharPref("experiments.manifest.uri", root + "manifest");
-
- // We need to remove the cache file to help ensure consistent state.
- yield OS.File.remove(gExperiments._cacheFilePath);
-
- Services.prefs.setBoolPref("experiments.enabled", true);
-
- info("Initializing experiments service.");
- yield gExperiments.init();
- info("Experiments service finished first run.");
-
- // Check conditions, just to be sure.
- let experiments = yield gExperiments.getExperiments();
- Assert.equal(experiments.length, 0, "No experiments known to the service.");
-
- // This makes testing easier.
- gExperiments._policy.ignoreHashes = true;
-
- info("Manually updating experiments manifest.");
- yield gExperiments.updateManifest();
- info("Experiments update complete.");
-
- let deferred = Promise.defer();
- gHttpServer.stop(() => {
- gHttpServer = null;
-
- info("getting experiment by ID");
- AddonManager.getAddonByID("test-experiment1@experiments.mozilla.org", (addon) => {
- Assert.ok(addon, "Add-on installed via Experiments manager.");
-
- deferred.resolve();
- });
- });
-
- yield deferred.promise;
-
- Assert.ok(gCategoryUtilities.isTypeVisible, "experiment", "Experiment tab visible.");
- yield gCategoryUtilities.openType("experiment");
- let el = gManagerWindow.document.getElementsByClassName("experiment-info-container")[0];
- is_element_visible(el, "Experiment info is visible on experiment tab.");
-});
-
-add_task(function testDeactivateExperiment() {
- if (!gExperiments) {
- return;
- }
-
- // Fake an empty manifest to purge data from previous manifest.
- yield gExperiments._updateExperiments({
- "version": 1,
- "experiments": [],
- });
-
- yield gExperiments.disableExperiment("testing");
-
- // We should have a record of the previously-active experiment.
- let experiments = yield gExperiments.getExperiments();
- Assert.equal(experiments.length, 1, "1 experiment is known.");
- Assert.equal(experiments[0].active, false, "Experiment is not active.");
-
- // We should have a previous experiment in the add-ons manager.
- let deferred = Promise.defer();
- AddonManager.getAddonsByTypes(["experiment"], (addons) => {
- deferred.resolve(addons);
- });
- let addons = yield deferred.promise;
- Assert.equal(addons.length, 1, "1 experiment add-on known.");
- Assert.ok(addons[0].appDisabled, "It is a previous experiment.");
- Assert.equal(addons[0].id, "experiment-1", "Add-on ID matches expected.");
-
- // Verify the UI looks sane.
-
- Assert.ok(gCategoryUtilities.isTypeVisible("experiment"), "Experiment tab visible.");
- let item = get_addon_element(gManagerWindow, "experiment-1");
- Assert.ok(item, "Got add-on element.");
- Assert.ok(!item.active, "Element should not be active.");
- item.parentNode.ensureElementIsVisible(item);
-
- // User control buttons should not be present because previous experiments
- // should have no permissions.
- let el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "remove-btn");
- is_element_hidden(el, "Remove button is not visible.");
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "disable-btn");
- is_element_hidden(el, "Disable button is not visible.");
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "enable-btn");
- is_element_hidden(el, "Enable button is not visible.");
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "preferences-btn");
- is_element_hidden(el, "Preferences button is not visible.");
-});
-
-add_task(function testActivateRealExperiments() {
- if (!gExperiments) {
- info("Skipping experiments test because that feature isn't available.");
- return;
- }
-
- yield gExperiments._updateExperiments({
- "version": 1,
- "experiments": [
- {
- id: "experiment-2",
- xpiURL: TESTROOT + "addons/browser_experiment1.xpi",
- xpiHash: "IRRELEVANT",
- startTime: Date.now() / 1000 - 3600,
- endTime: Date.now() / 1000 + 3600,
- maxActiveSeconds: 600,
- appName: [Services.appinfo.name],
- channel: [gExperiments._policy.updatechannel()],
- },
- ],
- });
- yield gExperiments._run();
-
- // Check the active experiment.
-
- let item = get_addon_element(gManagerWindow, "test-experiment1@experiments.mozilla.org");
- Assert.ok(item, "Got add-on element.");
- item.parentNode.ensureElementIsVisible(item);
-
- let el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "experiment-state");
- is_element_visible(el, "Experiment state label should be visible.");
- if (gIsEnUsLocale) {
- Assert.equal(el.value, "Active");
- }
-
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "experiment-time");
- is_element_visible(el, "Experiment time label should be visible.");
- if (gIsEnUsLocale) {
- Assert.equal(el.value, "Less than a day remaining");
- }
-
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "error-container");
- is_element_hidden(el, "error-container should be hidden.");
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "warning-container");
- is_element_hidden(el, "warning-container should be hidden.");
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "pending-container");
- is_element_hidden(el, "pending-container should be hidden.");
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "version");
- is_element_hidden(el, "version should be hidden.");
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "class", "disabled-postfix");
- is_element_hidden(el, "disabled-postfix should be hidden.");
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "class", "update-postfix");
- is_element_hidden(el, "update-postfix should be hidden.");
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "class", "experiment-bullet");
- is_element_visible(el, "experiment-bullet should be visible.");
-
- // Check the previous experiment.
-
- item = get_addon_element(gManagerWindow, "experiment-1");
- Assert.ok(item, "Got add-on element.");
- item.parentNode.ensureElementIsVisible(item);
-
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "experiment-state");
- is_element_visible(el, "Experiment state label should be visible.");
- if (gIsEnUsLocale) {
- Assert.equal(el.value, "Complete");
- }
-
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "experiment-time");
- is_element_visible(el, "Experiment time label should be visible.");
- if (gIsEnUsLocale) {
- Assert.equal(el.value, "Less than a day ago");
- }
-
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "error-container");
- is_element_hidden(el, "error-container should be hidden.");
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "warning-container");
- is_element_hidden(el, "warning-container should be hidden.");
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "pending-container");
- is_element_hidden(el, "pending-container should be hidden.");
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "version");
- is_element_hidden(el, "version should be hidden.");
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "class", "disabled-postfix");
- is_element_hidden(el, "disabled-postfix should be hidden.");
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "class", "update-postfix");
- is_element_hidden(el, "update-postfix should be hidden.");
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "class", "experiment-bullet");
- is_element_visible(el, "experiment-bullet should be visible.");
-
- // Install an "older" experiment.
-
- yield gExperiments.disableExperiment("experiment-2");
-
- let now = Date.now();
- let fakeNow = now - 5 * MS_IN_ONE_DAY;
- defineNow(gExperiments._policy, fakeNow);
-
- yield gExperiments._updateExperiments({
- "version": 1,
- "experiments": [
- {
- id: "experiment-3",
- xpiURL: TESTROOT + "addons/browser_experiment1.xpi",
- xpiHash: "IRRELEVANT",
- startTime: fakeNow / 1000 - SEC_IN_ONE_DAY,
- endTime: now / 1000 + 10 * SEC_IN_ONE_DAY,
- maxActiveSeconds: 100 * SEC_IN_ONE_DAY,
- appName: [Services.appinfo.name],
- channel: [gExperiments._policy.updatechannel()],
- },
- ],
- });
- yield gExperiments._run();
-
- // Check the active experiment.
-
- item = get_addon_element(gManagerWindow, "test-experiment1@experiments.mozilla.org");
- Assert.ok(item, "Got add-on element.");
- item.parentNode.ensureElementIsVisible(item);
-
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "experiment-state");
- is_element_visible(el, "Experiment state label should be visible.");
- if (gIsEnUsLocale) {
- Assert.equal(el.value, "Active");
- }
-
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "experiment-time");
- is_element_visible(el, "Experiment time label should be visible.");
- if (gIsEnUsLocale) {
- Assert.equal(el.value, "10 days remaining");
- }
-
- // Disable it and check it's previous experiment entry.
-
- yield gExperiments.disableExperiment("experiment-3");
-
- item = get_addon_element(gManagerWindow, "experiment-3");
- Assert.ok(item, "Got add-on element.");
- item.parentNode.ensureElementIsVisible(item);
-
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "experiment-state");
- is_element_visible(el, "Experiment state label should be visible.");
- if (gIsEnUsLocale) {
- Assert.equal(el.value, "Complete");
- }
-
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "experiment-time");
- is_element_visible(el, "Experiment time label should be visible.");
- if (gIsEnUsLocale) {
- Assert.equal(el.value, "5 days ago");
- }
-});
-
-add_task(function testDetailView() {
- if (!gExperiments) {
- info("Skipping experiments test because that feature isn't available.");
- return;
- }
-
- defineNow(gExperiments._policy, Date.now());
- yield gExperiments._updateExperiments({
- "version": 1,
- "experiments": [
- {
- id: "experiment-4",
- xpiURL: TESTROOT + "addons/browser_experiment1.xpi",
- xpiHash: "IRRELEVANT",
- startTime: Date.now() / 1000 - 3600,
- endTime: Date.now() / 1000 + 3600,
- maxActiveSeconds: 600,
- appName: [Services.appinfo.name],
- channel: [gExperiments._policy.updatechannel()],
- },
- ],
- });
- yield gExperiments._run();
-
- // Check active experiment.
-
- yield openDetailsView("test-experiment1@experiments.mozilla.org");
-
- let el = gManagerWindow.document.getElementById("detail-experiment-state");
- is_element_visible(el, "Experiment state label should be visible.");
- if (gIsEnUsLocale) {
- Assert.equal(el.value, "Active");
- }
-
- el = gManagerWindow.document.getElementById("detail-experiment-time");
- is_element_visible(el, "Experiment time label should be visible.");
- if (gIsEnUsLocale) {
- Assert.equal(el.value, "Less than a day remaining");
- }
-
- el = gManagerWindow.document.getElementById("detail-version");
- is_element_hidden(el, "detail-version should be hidden.");
- el = gManagerWindow.document.getElementById("detail-creator");
- is_element_hidden(el, "detail-creator should be hidden.");
- el = gManagerWindow.document.getElementById("detail-experiment-bullet");
- is_element_visible(el, "experiment-bullet should be visible.");
-
- // Check previous experiment.
-
- yield gCategoryUtilities.openType("experiment");
- yield openDetailsView("experiment-3");
-
- el = gManagerWindow.document.getElementById("detail-experiment-state");
- is_element_visible(el, "Experiment state label should be visible.");
- if (gIsEnUsLocale) {
- Assert.equal(el.value, "Complete");
- }
-
- el = gManagerWindow.document.getElementById("detail-experiment-time");
- is_element_visible(el, "Experiment time label should be visible.");
- if (gIsEnUsLocale) {
- Assert.equal(el.value, "5 days ago");
- }
-
- el = gManagerWindow.document.getElementById("detail-version");
- is_element_hidden(el, "detail-version should be hidden.");
- el = gManagerWindow.document.getElementById("detail-creator");
- is_element_hidden(el, "detail-creator should be hidden.");
- el = gManagerWindow.document.getElementById("detail-experiment-bullet");
- is_element_visible(el, "experiment-bullet should be visible.");
-});
-
-add_task(function* testRemoveAndUndo() {
- if (!gExperiments) {
- info("Skipping experiments test because that feature isn't available.");
- return;
- }
-
- yield gCategoryUtilities.openType("experiment");
-
- let addon = get_addon_element(gManagerWindow, "test-experiment1@experiments.mozilla.org");
- Assert.ok(addon, "Got add-on element.");
-
- yield clickRemoveButton(addon);
- addon.parentNode.ensureElementIsVisible(addon);
-
- let el = gManagerWindow.document.getAnonymousElementByAttribute(addon, "class", "pending");
- is_element_visible(el, "Uninstall undo information should be visible.");
-
- yield clickUndoButton(addon);
- addon = get_addon_element(gManagerWindow, "test-experiment1@experiments.mozilla.org");
- Assert.ok(addon, "Got add-on element.");
-});
-
-add_task(function* testCleanup() {
- if (gExperiments) {
- Services.prefs.clearUserPref("experiments.enabled");
- Services.prefs.setCharPref("experiments.manifest.uri", gSavedManifestURI);
-
- // We perform the uninit/init cycle to purge any leftover state.
- yield OS.File.remove(gExperiments._cacheFilePath);
- yield gExperiments.uninit();
- yield gExperiments.init();
- }
-
- // Check post-conditions.
- let addons = yield getExperimentAddons();
- Assert.equal(addons.length, 0, "No experiment add-ons are installed.");
-
- yield close_manager(gManagerWindow);
-});
diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_bootstrap_const.js b/toolkit/mozapps/extensions/test/xpcshell/test_bootstrap_const.js
new file mode 100644
index 000000000..fb02b59be
--- /dev/null
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_bootstrap_const.js
@@ -0,0 +1,17 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/
+ */
+
+createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1");
+startupManager();
+
+add_task(function*() {
+ let sawInstall = false;
+ Services.obs.addObserver(function() {
+ sawInstall = true;
+ }, "addon-install", false);
+
+ yield promiseInstallAllFiles([do_get_addon("test_bootstrap_const")]);
+
+ ok(sawInstall);
+}); \ No newline at end of file
diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_mapURIToAddonID.js b/toolkit/mozapps/extensions/test/xpcshell/test_mapURIToAddonID.js
index a6f9c8052..a153256dc 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/test_mapURIToAddonID.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_mapURIToAddonID.js
@@ -95,8 +95,10 @@ function run_test_early() {
"resource://gre/modules/addons/XPIProvider.jsm", {});
// Make the early API call.
- do_check_null(s.XPIProvider.mapURIToAddonID(uri));
+ // AddonManager still misses its provider and so doesn't work yet.
do_check_null(AddonManager.mapURIToAddonID(uri));
+ // But calling XPIProvider directly works immediately
+ do_check_eq(s.XPIProvider.mapURIToAddonID(uri), id);
// Actually start up the manager.
startupManager(false);
diff --git a/toolkit/mozapps/extensions/test/xpcshell/xpcshell-shared.ini b/toolkit/mozapps/extensions/test/xpcshell/xpcshell-shared.ini
index bab072e83..2a12f147a 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/xpcshell-shared.ini
+++ b/toolkit/mozapps/extensions/test/xpcshell/xpcshell-shared.ini
@@ -29,6 +29,7 @@ skip-if = os == "android"
[test_bootstrap.js]
# Bug 676992: test consistently hangs on Android
skip-if = os == "android"
+[test_bootstrap_const.js]
[test_bootstrap_resource.js]
[test_bug299716.js]
# Bug 676992: test consistently hangs on Android
diff --git a/toolkit/mozapps/installer/find-dupes.py b/toolkit/mozapps/installer/find-dupes.py
index bd0561c97..34ef675f4 100644
--- a/toolkit/mozapps/installer/find-dupes.py
+++ b/toolkit/mozapps/installer/find-dupes.py
@@ -4,15 +4,8 @@
import sys
import hashlib
-import re
-from mozbuild.preprocessor import Preprocessor
-from mozbuild.util import DefinesAction
from mozpack.packager.unpack import UnpackFinder
-from mozpack.files import DeflatedFile
from collections import OrderedDict
-from StringIO import StringIO
-import argparse
-import buildconfig
'''
Find files duplicated in a given packaged directory, independently of its
@@ -20,116 +13,36 @@ package format.
'''
-def normalize_osx_path(p):
- '''
- Strips the first 3 elements of an OSX app path
-
- >>> normalize_osx_path('Nightly.app/foo/bar/baz')
- 'baz'
- '''
- bits = p.split('/')
- if len(bits) > 3 and bits[0].endswith('.app'):
- return '/'.join(bits[3:])
- return p
-
-
-def normalize_l10n_path(p):
- '''
- Normalizes localized paths to en-US
-
- >>> normalize_l10n_path('chrome/es-ES/locale/branding/brand.properties')
- 'chrome/en-US/locale/branding/brand.properties'
- >>> normalize_l10n_path('chrome/fr/locale/fr/browser/aboutHome.dtd')
- 'chrome/en-US/locale/en-US/browser/aboutHome.dtd'
- '''
- # Keep a trailing slash here! e.g. locales like 'br' can transform
- # 'chrome/br/locale/branding/' into 'chrome/en-US/locale/en-USanding/'
- p = re.sub(r'chrome/(\S+)/locale/\1/',
- 'chrome/en-US/locale/en-US/',
- p)
- p = re.sub(r'chrome/(\S+)/locale/',
- 'chrome/en-US/locale/',
- p)
- return p
-
-
-def normalize_path(p):
- return normalize_osx_path(normalize_l10n_path(p))
-
-
-def find_dupes(source, allowed_dupes, bail=True):
- allowed_dupes = set(allowed_dupes)
+def find_dupes(source):
md5s = OrderedDict()
for p, f in UnpackFinder(source):
content = f.open().read()
m = hashlib.md5(content).digest()
- if m not in md5s:
- if isinstance(f, DeflatedFile):
- compressed = f.file.compressed_size
- else:
- compressed = len(content)
- md5s[m] = (len(content), compressed, [])
- md5s[m][2].append(p)
+ if not m in md5s:
+ md5s[m] = (len(content), [])
+ md5s[m][1].append(p)
total = 0
- total_compressed = 0
num_dupes = 0
- unexpected_dupes = []
- for m, (size, compressed, paths) in sorted(md5s.iteritems(),
- key=lambda x: x[1][1]):
+ for m, (size, paths) in md5s.iteritems():
if len(paths) > 1:
- print 'Duplicates %d bytes%s%s:' % (size,
- ' (%d compressed)' % compressed if compressed != size else '',
+ print 'Duplicates %d bytes%s:' % (size,
' (%d times)' % (len(paths) - 1) if len(paths) > 2 else '')
print ''.join(' %s\n' % p for p in paths)
total += (len(paths) - 1) * size
- total_compressed += (len(paths) - 1) * compressed
num_dupes += 1
-
- unexpected_dupes.extend([p for p in paths if normalize_path(p) not in allowed_dupes])
-
if num_dupes:
- print "WARNING: Found %d duplicated files taking %d bytes (%s)" % \
- (num_dupes, total,
- '%d compressed' % total_compressed if total_compressed != total
- else 'uncompressed')
-
- if unexpected_dupes:
- errortype = "ERROR" if bail else "WARNING"
- print "%s: The following duplicated files are not allowed:" % errortype
- print "\n".join(unexpected_dupes)
- if bail:
- sys.exit(1)
+ print "WARNING: Found %d duplicated files taking %d bytes" % \
+ (num_dupes, total) + " (uncompressed)"
def main():
- parser = argparse.ArgumentParser(description='Find duplicate files in directory.')
- parser.add_argument('--warning', '-w', action='store_true',
- help='Only warn about duplicates, do not exit with an error')
- parser.add_argument('--file', '-f', action='append', dest='dupes_files', default=[],
- help='Add exceptions to the duplicate list from this file')
- parser.add_argument('-D', action=DefinesAction)
- parser.add_argument('-U', action='append', default=[])
- parser.add_argument('directory',
- help='The directory to check for duplicates in')
-
- args = parser.parse_args()
-
- allowed_dupes = []
- for filename in args.dupes_files:
- pp = Preprocessor()
- pp.context.update(buildconfig.defines)
- if args.D:
- pp.context.update(args.D)
- for undefine in args.U:
- if undefine in pp.context:
- del pp.context[undefine]
- pp.out = StringIO()
- pp.do_filter('substitution')
- pp.do_include(filename)
- allowed_dupes.extend([line.partition('#')[0].rstrip()
- for line in pp.out.getvalue().splitlines()])
+ if len(sys.argv) != 2:
+ import os
+ print >>sys.stderr, "Usage: %s directory" % \
+ os.path.basename(sys.argv[0])
+ sys.exit(1)
- find_dupes(args.directory, bail=not args.warning, allowed_dupes=allowed_dupes)
+ find_dupes(sys.argv[1])
if __name__ == "__main__":
main()
diff --git a/toolkit/mozapps/installer/packager.mk b/toolkit/mozapps/installer/packager.mk
index 68247e7df..71a956aa4 100644
--- a/toolkit/mozapps/installer/packager.mk
+++ b/toolkit/mozapps/installer/packager.mk
@@ -54,7 +54,7 @@ stage-package: $(MOZ_PKG_MANIFEST) $(MOZ_PKG_MANIFEST_DEPS)
$(addprefix --unify ,$(UNIFY_DIST)) \
$(MOZ_PKG_MANIFEST) $(DIST) $(DIST)/$(STAGEPATH)$(MOZ_PKG_DIR)$(if $(MOZ_PKG_MANIFEST),,$(_BINPATH)) \
$(if $(filter omni,$(MOZ_PACKAGER_FORMAT)),$(if $(NON_OMNIJAR_FILES),--non-resource $(NON_OMNIJAR_FILES)))
- $(PYTHON) $(MOZILLA_DIR)/toolkit/mozapps/installer/find-dupes.py $(DEFINES) $(ACDEFINES) $(MOZ_PKG_DUPEFLAGS) $(DIST)/$(STAGEPATH)$(MOZ_PKG_DIR)
+ $(PYTHON) $(MOZILLA_DIR)/toolkit/mozapps/installer/find-dupes.py $(DIST)/$(STAGEPATH)$(MOZ_PKG_DIR)
ifdef MOZ_PACKAGE_JSSHELL
# Package JavaScript Shell
@echo 'Packaging JavaScript Shell...'
diff --git a/toolkit/mozapps/preferences/changemp.js b/toolkit/mozapps/preferences/changemp.js
index 82dd20128..71664b3e1 100644
--- a/toolkit/mozapps/preferences/changemp.js
+++ b/toolkit/mozapps/preferences/changemp.js
@@ -167,8 +167,8 @@ function setPasswordStrength()
// length of the password
var pwlength=(pw.length);
- if (pwlength>5)
- pwlength=5;
+ if (pwlength>10)
+ pwlength=10;
// use of numbers in the password
@@ -190,7 +190,7 @@ function setPasswordStrength()
upper=3;
- var pwstrength=((pwlength*10)-20) + (numeric*10) + (numsymbols*15) + (upper*10);
+ var pwstrength=((pwlength*5)-20) + (numeric*10) + (numsymbols*15) + (upper*10);
// make sure we're give a value between 0 and 100
if ( pwstrength < 0 ) {
@@ -227,6 +227,12 @@ function checkPasswords()
}
}
+ // Never accept short passwords < 8 chars
+ if (pw1.length < 8) {
+ ok.setAttribute("disabled", "true");
+ return;
+ }
+
if (pw1 == pw2) {
ok.setAttribute("disabled", "false");
} else
diff --git a/toolkit/mozapps/preferences/changemp.xul b/toolkit/mozapps/preferences/changemp.xul
index 14d02295e..b316fa42b 100644
--- a/toolkit/mozapps/preferences/changemp.xul
+++ b/toolkit/mozapps/preferences/changemp.xul
@@ -34,7 +34,7 @@
<rows>
<row>
<label control="oldpw">&setPassword.oldPassword.label;</label>
- <textbox id="oldpw" type="password"/>
+ <textbox id="oldpw" type="password" size="18"/>
<!-- This textbox is inserted as a workaround to the fact that making the 'type'
& 'disabled' property of the 'oldpw' textbox toggle between ['password' &
'false'] and ['text' & 'true'] - as would be necessary if the menu has more
@@ -46,12 +46,13 @@
</row>
<row>
<label control="pw1">&setPassword.newPassword.label;</label>
- <textbox id="pw1" type="password"
+ <textbox id="pw1" type="password" size="18"
oninput="setPasswordStrength(); checkPasswords();"/>
</row>
<row>
<label control="pw2">&setPassword.reenterPassword.label;</label>
- <textbox id="pw2" type="password" oninput="checkPasswords();"/>
+ <textbox id="pw2" type="password" size="18"
+ oninput="checkPasswords();"/>
</row>
</rows>
</grid>
diff --git a/toolkit/mozapps/webextensions/content/extensions.js b/toolkit/mozapps/webextensions/content/extensions.js
index 5e428fe17..3159eb1e1 100644
--- a/toolkit/mozapps/webextensions/content/extensions.js
+++ b/toolkit/mozapps/webextensions/content/extensions.js
@@ -29,9 +29,6 @@ XPCOMUtils.defineLazyModuleGetter(this, "PluralForm",
XPCOMUtils.defineLazyModuleGetter(this, "Preferences",
"resource://gre/modules/Preferences.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "Experiments",
- "resource:///modules/experiments/Experiments.jsm");
-
const PREF_DISCOVERURL = "extensions.webservice.discoverURL";
const PREF_DISCOVER_ENABLED = "extensions.getAddons.showPane";
const PREF_XPI_ENABLED = "xpinstall.enabled";
@@ -297,23 +294,6 @@ function isDiscoverEnabled() {
return true;
}
-function getExperimentEndDate(aAddon) {
- if (!("@mozilla.org/browser/experiments-service;1" in Cc)) {
- return 0;
- }
-
- if (!aAddon.isActive) {
- return aAddon.endDate;
- }
-
- let experiment = Experiments.instance().getActiveExperiment();
- if (!experiment) {
- return 0;
- }
-
- return experiment.endDate;
-}
-
/**
* Obtain the main DOMWindow for the current context.
*/
@@ -1444,27 +1424,6 @@ var gViewController = {
}
},
- cmd_experimentsLearnMore: {
- isEnabled: function() {
- let mainWindow = getMainWindow();
- return mainWindow && "switchToTabHavingURI" in mainWindow;
- },
- doCommand: function() {
- let url = Services.prefs.getCharPref("toolkit.telemetry.infoURL");
- openOptionsInTab(url);
- },
- },
-
- cmd_experimentsOpenTelemetryPreferences: {
- isEnabled: function() {
- return !!getMainWindowWithPreferencesPane();
- },
- doCommand: function() {
- let mainWindow = getMainWindowWithPreferencesPane();
- mainWindow.openAdvancedPreferences("dataChoicesTab");
- },
- },
-
cmd_showUnsignedExtensions: {
isEnabled: function() {
return true;
@@ -1577,10 +1536,6 @@ function shouldShowVersionNumber(aAddon) {
if (!aAddon.version)
return false;
- // The version number is hidden for experiments.
- if (aAddon.type == "experiment")
- return false;
-
// The version number is hidden for lightweight themes.
if (aAddon.type == "theme")
return !/@personas\.mozilla\.org$/.test(aAddon.id);
@@ -1614,10 +1569,6 @@ function createItem(aObj, aIsInstall, aIsRemote) {
// the binding handles the rest
item.setAttribute("value", aObj.id);
- if (aObj.type == "experiment") {
- item.endDate = getExperimentEndDate(aObj);
- }
-
return item;
}
@@ -2861,13 +2812,6 @@ var gListView = {
// the existing item
if (aInstall.existingAddon)
this.removeItem(aInstall, true);
-
- if (aInstall.addon.type == "experiment") {
- let item = this.getListItemForID(aInstall.addon.id);
- if (item) {
- item.endDate = getExperimentEndDate(aInstall.addon);
- }
- }
},
addItem: function(aObj, aIsInstall) {
@@ -3126,34 +3070,6 @@ var gDetailView = {
}
}
- if (this._addon.type == "experiment") {
- let prefix = "details.experiment.";
- let active = this._addon.isActive;
-
- let stateKey = prefix + "state." + (active ? "active" : "complete");
- let node = document.getElementById("detail-experiment-state");
- node.value = gStrings.ext.GetStringFromName(stateKey);
-
- let now = Date.now();
- let end = getExperimentEndDate(this._addon);
- let days = Math.abs(end - now) / (24 * 60 * 60 * 1000);
-
- let timeKey = prefix + "time.";
- let timeMessage;
- if (days < 1) {
- timeKey += (active ? "endsToday" : "endedToday");
- timeMessage = gStrings.ext.GetStringFromName(timeKey);
- } else {
- timeKey += (active ? "daysRemaining" : "daysPassed");
- days = Math.round(days);
- let timeString = gStrings.ext.GetStringFromName(timeKey);
- timeMessage = PluralForm.get(days, timeString)
- .replace("#1", days);
- }
-
- document.getElementById("detail-experiment-time").value = timeMessage;
- }
-
this.fillSettingsRows(aScrollToPreferences, (function() {
this.updateState();
gViewController.notifyViewChanged();
diff --git a/toolkit/mozapps/webextensions/internal/XPIProvider.jsm b/toolkit/mozapps/webextensions/internal/XPIProvider.jsm
index 87e09cef1..7c3cb6763 100644
--- a/toolkit/mozapps/webextensions/internal/XPIProvider.jsm
+++ b/toolkit/mozapps/webextensions/internal/XPIProvider.jsm
@@ -175,6 +175,8 @@ const RDFURI_INSTALL_MANIFEST_ROOT = "urn:mozilla:install-manifest";
const PREFIX_NS_EM = "http://www.mozilla.org/2004/em-rdf#";
const TOOLKIT_ID = "toolkit@mozilla.org";
+const WEBEXTENSIONS_ID = "webextensions@mozilla.org";
+const WEBEXTENSIONS_VERSION = "52.0";
const XPI_SIGNATURE_CHECK_PERIOD = 24 * 60 * 60;
@@ -1037,7 +1039,7 @@ var loadManifestFromWebManifest = Task.async(function*(aUri) {
delete addon.defaultLocale.locales;
addon.targetApplications = [{
- id: TOOLKIT_ID,
+ id: WEBEXTENSIONS_ID,
minVersion: bss.strict_min_version,
maxVersion: bss.strict_max_version,
}];
@@ -7228,6 +7230,8 @@ AddonInternal.prototype = {
version = aAppVersion;
else if (app.id == TOOLKIT_ID)
version = aPlatformVersion
+ else if (app.id == WEBEXTENSIONS_ID)
+ version = WEBEXTENSIONS_VERSION
// Only extensions and dictionaries can be compatible by default; themes
// and language packs always use strict compatibility checking.
@@ -7250,7 +7254,7 @@ AddonInternal.prototype = {
let minCompatVersion;
if (app.id == Services.appinfo.ID)
minCompatVersion = XPIProvider.minCompatibleAppVersion;
- else if (app.id == TOOLKIT_ID)
+ else if (app.id == TOOLKIT_ID || app.id == WEBEXTENSIONS_ID)
minCompatVersion = XPIProvider.minCompatiblePlatformVersion;
if (minCompatVersion &&
@@ -7269,7 +7273,7 @@ AddonInternal.prototype = {
for (let targetApp of this.targetApplications) {
if (targetApp.id == Services.appinfo.ID)
return targetApp;
- if (targetApp.id == TOOLKIT_ID)
+ if (targetApp.id == TOOLKIT_ID || targetApp.id == WEBEXTENSIONS_ID)
app = targetApp;
}
return app;
diff --git a/toolkit/mozapps/webextensions/test/browser/browser-common.ini b/toolkit/mozapps/webextensions/test/browser/browser-common.ini
index eda266e2f..83920465b 100644
--- a/toolkit/mozapps/webextensions/test/browser/browser-common.ini
+++ b/toolkit/mozapps/webextensions/test/browser/browser-common.ini
@@ -34,7 +34,6 @@ skip-if = true # Bug 1093190 - Disabled due to leak
[browser_discovery.js]
[browser_dragdrop.js]
skip-if = buildapp == 'mulet'
-[browser_experiments.js]
[browser_list.js]
[browser_metadataTimeout.js]
[browser_searching.js]
diff --git a/toolkit/mozapps/webextensions/test/browser/browser_experiments.js b/toolkit/mozapps/webextensions/test/browser/browser_experiments.js
deleted file mode 100644
index 18a548de5..000000000
--- a/toolkit/mozapps/webextensions/test/browser/browser_experiments.js
+++ /dev/null
@@ -1,654 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-Components.utils.import("resource://gre/modules/Promise.jsm", this);
-
-var {AddonManagerTesting} = Components.utils.import("resource://testing-common/AddonManagerTesting.jsm", {});
-var {HttpServer} = Components.utils.import("resource://testing-common/httpd.js", {});
-
-var gManagerWindow;
-var gCategoryUtilities;
-var gExperiments;
-var gHttpServer;
-
-var gSavedManifestURI;
-var gIsEnUsLocale;
-
-const SEC_IN_ONE_DAY = 24 * 60 * 60;
-const MS_IN_ONE_DAY = SEC_IN_ONE_DAY * 1000;
-
-function getExperimentAddons() {
- let deferred = Promise.defer();
- AddonManager.getAddonsByTypes(["experiment"], (addons) => {
- deferred.resolve(addons);
- });
- return deferred.promise;
-}
-
-function getInstallItem() {
- let doc = gManagerWindow.document;
- let view = get_current_view(gManagerWindow);
- let list = doc.getElementById("addon-list");
-
- let node = list.firstChild;
- while (node) {
- if (node.getAttribute("status") == "installing") {
- return node;
- }
- node = node.nextSibling;
- }
-
- return null;
-}
-
-function patchPolicy(policy, data) {
- for (let key of Object.keys(data)) {
- Object.defineProperty(policy, key, {
- value: data[key],
- writable: true,
- });
- }
-}
-
-function defineNow(policy, time) {
- patchPolicy(policy, { now: () => new Date(time) });
-}
-
-function openDetailsView(aId) {
- let item = get_addon_element(gManagerWindow, aId);
- Assert.ok(item, "Should have got add-on element.");
- is_element_visible(item, "Add-on element should be visible.");
-
- EventUtils.synthesizeMouseAtCenter(item, { clickCount: 1 }, gManagerWindow);
- EventUtils.synthesizeMouseAtCenter(item, { clickCount: 2 }, gManagerWindow);
-
- let deferred = Promise.defer();
- wait_for_view_load(gManagerWindow, deferred.resolve);
- return deferred.promise;
-}
-
-function clickRemoveButton(addonElement) {
- let btn = gManagerWindow.document.getAnonymousElementByAttribute(addonElement, "anonid", "remove-btn");
- if (!btn) {
- return Promise.reject();
- }
-
- EventUtils.synthesizeMouseAtCenter(btn, { clickCount: 1 }, gManagerWindow);
- let deferred = Promise.defer();
- setTimeout(deferred.resolve, 0);
- return deferred;
-}
-
-function clickUndoButton(addonElement) {
- let btn = gManagerWindow.document.getAnonymousElementByAttribute(addonElement, "anonid", "undo-btn");
- if (!btn) {
- return Promise.reject();
- }
-
- EventUtils.synthesizeMouseAtCenter(btn, { clickCount: 1 }, gManagerWindow);
- let deferred = Promise.defer();
- setTimeout(deferred.resolve, 0);
- return deferred;
-}
-
-add_task(function* initializeState() {
- gManagerWindow = yield open_manager();
- gCategoryUtilities = new CategoryUtilities(gManagerWindow);
-
- registerCleanupFunction(() => {
- Services.prefs.clearUserPref("experiments.enabled");
- Services.prefs.clearUserPref("toolkit.telemetry.enabled");
- if (gHttpServer) {
- gHttpServer.stop(() => {});
- if (gSavedManifestURI !== undefined) {
- Services.prefs.setCharPref("experments.manifest.uri", gSavedManifestURI);
- }
- }
- if (gExperiments) {
- let tmp = {};
- Cu.import("resource:///modules/experiments/Experiments.jsm", tmp);
- gExperiments._policy = new tmp.Experiments.Policy();
- }
- });
-
- let chrome = Cc["@mozilla.org/chrome/chrome-registry;1"].getService(Ci.nsIXULChromeRegistry);
- gIsEnUsLocale = chrome.getSelectedLocale("global") == "en-US";
-
- // The Experiments Manager will interfere with us by preventing installs
- // of experiments it doesn't know about. We remove it from the equation
- // because here we are only concerned with core Addon Manager operation,
- // not the superset Experiments Manager has imposed.
- if ("@mozilla.org/browser/experiments-service;1" in Components.classes) {
- let tmp = {};
- Cu.import("resource:///modules/experiments/Experiments.jsm", tmp);
- // There is a race condition between XPCOM service initialization and
- // this test running. We have to initialize the instance first, then
- // uninitialize it to prevent this.
- gExperiments = tmp.Experiments.instance();
- yield gExperiments._mainTask;
- yield gExperiments.uninit();
- }
-});
-
-// On an empty profile with no experiments, the experiment category
-// should be hidden.
-add_task(function* testInitialState() {
- Assert.ok(gCategoryUtilities.get("experiment", false), "Experiment tab is defined.");
- Assert.ok(!gCategoryUtilities.isTypeVisible("experiment"), "Experiment tab hidden by default.");
-});
-
-add_task(function* testExperimentInfoNotVisible() {
- yield gCategoryUtilities.openType("extension");
- let el = gManagerWindow.document.getElementsByClassName("experiment-info-container")[0];
- is_element_hidden(el, "Experiment info not visible on other types.");
-});
-
-// If we have an active experiment, we should see the experiments tab
-// and that tab should have some messages.
-add_task(function* testActiveExperiment() {
- let addon = yield install_addon("addons/browser_experiment1.xpi");
-
- Assert.ok(addon.userDisabled, "Add-on is disabled upon initial install.");
- Assert.equal(addon.isActive, false, "Add-on is not active.");
-
- Assert.ok(gCategoryUtilities.isTypeVisible("experiment"), "Experiment tab visible.");
-
- yield gCategoryUtilities.openType("experiment");
- let el = gManagerWindow.document.getElementsByClassName("experiment-info-container")[0];
- is_element_visible(el, "Experiment info is visible on experiment tab.");
-});
-
-add_task(function* testExperimentLearnMore() {
- // Actual URL is irrelevant.
- Services.prefs.setCharPref("toolkit.telemetry.infoURL",
- "http://mochi.test:8888/server.js");
-
- yield gCategoryUtilities.openType("experiment");
- let btn = gManagerWindow.document.getElementById("experiments-learn-more");
-
- if (!gUseInContentUI) {
- is_element_hidden(btn, "Learn more button hidden if not using in-content UI.");
- Services.prefs.clearUserPref("toolkit.telemetry.infoURL");
-
- return;
- }
-
- is_element_visible(btn, "Learn more button visible.");
-
- let deferred = Promise.defer();
- window.addEventListener("DOMContentLoaded", function onLoad(event) {
- info("Telemetry privacy policy window opened.");
- window.removeEventListener("DOMContentLoaded", onLoad, false);
-
- let browser = gBrowser.selectedBrowser;
- let expected = Services.prefs.getCharPref("toolkit.telemetry.infoURL");
- Assert.equal(browser.currentURI.spec, expected, "New tab should have loaded privacy policy.");
- browser.contentWindow.close();
-
- Services.prefs.clearUserPref("toolkit.telemetry.infoURL");
-
- deferred.resolve();
- }, false);
-
- info("Opening telemetry privacy policy.");
- EventUtils.synthesizeMouseAtCenter(btn, {}, gManagerWindow);
-
- yield deferred.promise;
-});
-
-add_task(function* testOpenPreferences() {
- yield gCategoryUtilities.openType("experiment");
- let btn = gManagerWindow.document.getElementById("experiments-change-telemetry");
- if (!gUseInContentUI) {
- is_element_hidden(btn, "Change telemetry button not enabled in out of window UI.");
- info("Skipping preferences open test because not using in-content UI.");
- return;
- }
-
- is_element_visible(btn, "Change telemetry button visible in in-content UI.");
-
- let deferred = Promise.defer();
- Services.obs.addObserver(function observer(prefWin, topic, data) {
- Services.obs.removeObserver(observer, "advanced-pane-loaded");
- info("Advanced preference pane opened.");
- executeSoon(function() {
- // We want this test to fail if the preferences pane changes.
- let el = prefWin.document.getElementById("dataChoicesPanel");
- is_element_visible(el);
-
- prefWin.close();
- info("Closed preferences pane.");
-
- deferred.resolve();
- });
- }, "advanced-pane-loaded", false);
-
- info("Loading preferences pane.");
- // We need to focus before synthesizing the mouse event (bug 1240052) as
- // synthesizeMouseAtCenter currently only synthesizes the mouse in the child process.
- // This can cause some subtle differences if the child isn't focused.
- yield SimpleTest.promiseFocus();
- yield BrowserTestUtils.synthesizeMouseAtCenter("#experiments-change-telemetry", {},
- gBrowser.selectedBrowser);
-
- yield deferred.promise;
-});
-
-add_task(function* testButtonPresence() {
- yield gCategoryUtilities.openType("experiment");
- let item = get_addon_element(gManagerWindow, "test-experiment1@experiments.mozilla.org");
- Assert.ok(item, "Got add-on element.");
- item.parentNode.ensureElementIsVisible(item);
-
- let el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "remove-btn");
- // Corresponds to the uninstall permission.
- is_element_visible(el, "Remove button is visible.");
- // Corresponds to lack of disable permission.
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "disable-btn");
- is_element_hidden(el, "Disable button not visible.");
- // Corresponds to lack of enable permission.
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "enable-btn");
- is_element_hidden(el, "Enable button not visible.");
-});
-
-// Remove the add-on we've been testing with.
-add_task(function* testCleanup() {
- yield AddonManagerTesting.uninstallAddonByID("test-experiment1@experiments.mozilla.org");
- // Verify some conditions, just in case.
- let addons = yield getExperimentAddons();
- Assert.equal(addons.length, 0, "No experiment add-ons are installed.");
-});
-
-// The following tests should ideally live in browser/experiments/. However,
-// they rely on some of the helper functions from head.js, which can't easily
-// be consumed from other directories. So, they live here.
-
-add_task(function* testActivateExperiment() {
- if (!gExperiments) {
- info("Skipping experiments test because that feature isn't available.");
- return;
- }
-
- gHttpServer = new HttpServer();
- gHttpServer.start(-1);
- let root = "http://localhost:" + gHttpServer.identity.primaryPort + "/";
- gHttpServer.registerPathHandler("/manifest", (request, response) => {
- response.setStatusLine(null, 200, "OK");
- response.write(JSON.stringify({
- "version": 1,
- "experiments": [
- {
- id: "experiment-1",
- xpiURL: TESTROOT + "addons/browser_experiment1.xpi",
- xpiHash: "IRRELEVANT",
- startTime: Date.now() / 1000 - 3600,
- endTime: Date.now() / 1000 + 3600,
- maxActiveSeconds: 600,
- appName: [Services.appinfo.name],
- channel: [gExperiments._policy.updatechannel()],
- },
- ],
- }));
- response.processAsync();
- response.finish();
- });
-
- gSavedManifestURI = Services.prefs.getCharPref("experiments.manifest.uri");
- Services.prefs.setCharPref("experiments.manifest.uri", root + "manifest");
-
- // We need to remove the cache file to help ensure consistent state.
- yield OS.File.remove(gExperiments._cacheFilePath);
-
- Services.prefs.setBoolPref("toolkit.telemetry.enabled", true);
- Services.prefs.setBoolPref("experiments.enabled", true);
-
- info("Initializing experiments service.");
- yield gExperiments.init();
- info("Experiments service finished first run.");
-
- // Check conditions, just to be sure.
- let experiments = yield gExperiments.getExperiments();
- Assert.equal(experiments.length, 0, "No experiments known to the service.");
-
- // This makes testing easier.
- gExperiments._policy.ignoreHashes = true;
-
- info("Manually updating experiments manifest.");
- yield gExperiments.updateManifest();
- info("Experiments update complete.");
-
- let deferred = Promise.defer();
- gHttpServer.stop(() => {
- gHttpServer = null;
-
- info("getting experiment by ID");
- AddonManager.getAddonByID("test-experiment1@experiments.mozilla.org", (addon) => {
- Assert.ok(addon, "Add-on installed via Experiments manager.");
-
- deferred.resolve();
- });
- });
-
- yield deferred.promise;
-
- Assert.ok(gCategoryUtilities.isTypeVisible, "experiment", "Experiment tab visible.");
- yield gCategoryUtilities.openType("experiment");
- let el = gManagerWindow.document.getElementsByClassName("experiment-info-container")[0];
- is_element_visible(el, "Experiment info is visible on experiment tab.");
-});
-
-add_task(function* testDeactivateExperiment() {
- if (!gExperiments) {
- return;
- }
-
- // Fake an empty manifest to purge data from previous manifest.
- yield gExperiments._updateExperiments({
- "version": 1,
- "experiments": [],
- });
-
- yield gExperiments.disableExperiment("testing");
-
- // We should have a record of the previously-active experiment.
- let experiments = yield gExperiments.getExperiments();
- Assert.equal(experiments.length, 1, "1 experiment is known.");
- Assert.equal(experiments[0].active, false, "Experiment is not active.");
-
- // We should have a previous experiment in the add-ons manager.
- let deferred = Promise.defer();
- AddonManager.getAddonsByTypes(["experiment"], (addons) => {
- deferred.resolve(addons);
- });
- let addons = yield deferred.promise;
- Assert.equal(addons.length, 1, "1 experiment add-on known.");
- Assert.ok(addons[0].appDisabled, "It is a previous experiment.");
- Assert.equal(addons[0].id, "experiment-1", "Add-on ID matches expected.");
-
- // Verify the UI looks sane.
-
- Assert.ok(gCategoryUtilities.isTypeVisible("experiment"), "Experiment tab visible.");
- let item = get_addon_element(gManagerWindow, "experiment-1");
- Assert.ok(item, "Got add-on element.");
- Assert.ok(!item.active, "Element should not be active.");
- item.parentNode.ensureElementIsVisible(item);
-
- // User control buttons should not be present because previous experiments
- // should have no permissions.
- let el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "remove-btn");
- is_element_hidden(el, "Remove button is not visible.");
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "disable-btn");
- is_element_hidden(el, "Disable button is not visible.");
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "enable-btn");
- is_element_hidden(el, "Enable button is not visible.");
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "preferences-btn");
- is_element_hidden(el, "Preferences button is not visible.");
-});
-
-add_task(function* testActivateRealExperiments() {
- if (!gExperiments) {
- info("Skipping experiments test because that feature isn't available.");
- return;
- }
-
- yield gExperiments._updateExperiments({
- "version": 1,
- "experiments": [
- {
- id: "experiment-2",
- xpiURL: TESTROOT + "addons/browser_experiment1.xpi",
- xpiHash: "IRRELEVANT",
- startTime: Date.now() / 1000 - 3600,
- endTime: Date.now() / 1000 + 3600,
- maxActiveSeconds: 600,
- appName: [Services.appinfo.name],
- channel: [gExperiments._policy.updatechannel()],
- },
- ],
- });
- yield gExperiments._run();
-
- // Check the active experiment.
-
- let item = get_addon_element(gManagerWindow, "test-experiment1@experiments.mozilla.org");
- Assert.ok(item, "Got add-on element.");
- item.parentNode.ensureElementIsVisible(item);
-
- let el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "experiment-state");
- is_element_visible(el, "Experiment state label should be visible.");
- if (gIsEnUsLocale) {
- Assert.equal(el.value, "Active");
- }
-
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "experiment-time");
- is_element_visible(el, "Experiment time label should be visible.");
- if (gIsEnUsLocale) {
- Assert.equal(el.value, "Less than a day remaining");
- }
-
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "error-container");
- is_element_hidden(el, "error-container should be hidden.");
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "warning-container");
- is_element_hidden(el, "warning-container should be hidden.");
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "pending-container");
- is_element_hidden(el, "pending-container should be hidden.");
- let { version } = yield get_tooltip_info(item);
- Assert.equal(version, undefined, "version should be hidden.");
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "class", "disabled-postfix");
- is_element_hidden(el, "disabled-postfix should be hidden.");
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "class", "update-postfix");
- is_element_hidden(el, "update-postfix should be hidden.");
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "class", "experiment-bullet");
- is_element_visible(el, "experiment-bullet should be visible.");
-
- // Check the previous experiment.
-
- item = get_addon_element(gManagerWindow, "experiment-1");
- Assert.ok(item, "Got add-on element.");
- item.parentNode.ensureElementIsVisible(item);
-
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "experiment-state");
- is_element_visible(el, "Experiment state label should be visible.");
- if (gIsEnUsLocale) {
- Assert.equal(el.value, "Complete");
- }
-
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "experiment-time");
- is_element_visible(el, "Experiment time label should be visible.");
- if (gIsEnUsLocale) {
- Assert.equal(el.value, "Less than a day ago");
- }
-
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "error-container");
- is_element_hidden(el, "error-container should be hidden.");
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "warning-container");
- is_element_hidden(el, "warning-container should be hidden.");
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "pending-container");
- is_element_hidden(el, "pending-container should be hidden.");
- ({ version } = yield get_tooltip_info(item));
- Assert.equal(version, undefined, "version should be hidden.");
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "class", "disabled-postfix");
- is_element_hidden(el, "disabled-postfix should be hidden.");
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "class", "update-postfix");
- is_element_hidden(el, "update-postfix should be hidden.");
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "class", "experiment-bullet");
- is_element_visible(el, "experiment-bullet should be visible.");
-
- // Install an "older" experiment.
-
- yield gExperiments.disableExperiment("experiment-2");
-
- let now = Date.now();
- let fakeNow = now - 5 * MS_IN_ONE_DAY;
- defineNow(gExperiments._policy, fakeNow);
-
- yield gExperiments._updateExperiments({
- "version": 1,
- "experiments": [
- {
- id: "experiment-3",
- xpiURL: TESTROOT + "addons/browser_experiment1.xpi",
- xpiHash: "IRRELEVANT",
- startTime: fakeNow / 1000 - SEC_IN_ONE_DAY,
- endTime: now / 1000 + 10 * SEC_IN_ONE_DAY,
- maxActiveSeconds: 100 * SEC_IN_ONE_DAY,
- appName: [Services.appinfo.name],
- channel: [gExperiments._policy.updatechannel()],
- },
- ],
- });
- yield gExperiments._run();
-
- // Check the active experiment.
-
- item = get_addon_element(gManagerWindow, "test-experiment1@experiments.mozilla.org");
- Assert.ok(item, "Got add-on element.");
- item.parentNode.ensureElementIsVisible(item);
-
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "experiment-state");
- is_element_visible(el, "Experiment state label should be visible.");
- if (gIsEnUsLocale) {
- Assert.equal(el.value, "Active");
- }
-
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "experiment-time");
- is_element_visible(el, "Experiment time label should be visible.");
- if (gIsEnUsLocale) {
- Assert.equal(el.value, "10 days remaining");
- }
-
- // Disable it and check it's previous experiment entry.
-
- yield gExperiments.disableExperiment("experiment-3");
-
- item = get_addon_element(gManagerWindow, "experiment-3");
- Assert.ok(item, "Got add-on element.");
- item.parentNode.ensureElementIsVisible(item);
-
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "experiment-state");
- is_element_visible(el, "Experiment state label should be visible.");
- if (gIsEnUsLocale) {
- Assert.equal(el.value, "Complete");
- }
-
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "experiment-time");
- is_element_visible(el, "Experiment time label should be visible.");
- if (gIsEnUsLocale) {
- Assert.equal(el.value, "5 days ago");
- }
-});
-
-add_task(function* testDetailView() {
- if (!gExperiments) {
- info("Skipping experiments test because that feature isn't available.");
- return;
- }
-
- defineNow(gExperiments._policy, Date.now());
- yield gExperiments._updateExperiments({
- "version": 1,
- "experiments": [
- {
- id: "experiment-4",
- xpiURL: TESTROOT + "addons/browser_experiment1.xpi",
- xpiHash: "IRRELEVANT",
- startTime: Date.now() / 1000 - 3600,
- endTime: Date.now() / 1000 + 3600,
- maxActiveSeconds: 600,
- appName: [Services.appinfo.name],
- channel: [gExperiments._policy.updatechannel()],
- },
- ],
- });
- yield gExperiments._run();
-
- // Check active experiment.
-
- yield openDetailsView("test-experiment1@experiments.mozilla.org");
-
- let el = gManagerWindow.document.getElementById("detail-experiment-state");
- is_element_visible(el, "Experiment state label should be visible.");
- if (gIsEnUsLocale) {
- Assert.equal(el.value, "Active");
- }
-
- el = gManagerWindow.document.getElementById("detail-experiment-time");
- is_element_visible(el, "Experiment time label should be visible.");
- if (gIsEnUsLocale) {
- Assert.equal(el.value, "Less than a day remaining");
- }
-
- el = gManagerWindow.document.getElementById("detail-version");
- is_element_hidden(el, "detail-version should be hidden.");
- el = gManagerWindow.document.getElementById("detail-creator");
- is_element_hidden(el, "detail-creator should be hidden.");
- el = gManagerWindow.document.getElementById("detail-experiment-bullet");
- is_element_visible(el, "experiment-bullet should be visible.");
-
- // Check previous experiment.
-
- yield gCategoryUtilities.openType("experiment");
- yield openDetailsView("experiment-3");
-
- el = gManagerWindow.document.getElementById("detail-experiment-state");
- is_element_visible(el, "Experiment state label should be visible.");
- if (gIsEnUsLocale) {
- Assert.equal(el.value, "Complete");
- }
-
- el = gManagerWindow.document.getElementById("detail-experiment-time");
- is_element_visible(el, "Experiment time label should be visible.");
- if (gIsEnUsLocale) {
- Assert.equal(el.value, "5 days ago");
- }
-
- el = gManagerWindow.document.getElementById("detail-version");
- is_element_hidden(el, "detail-version should be hidden.");
- el = gManagerWindow.document.getElementById("detail-creator");
- is_element_hidden(el, "detail-creator should be hidden.");
- el = gManagerWindow.document.getElementById("detail-experiment-bullet");
- is_element_visible(el, "experiment-bullet should be visible.");
-});
-
-add_task(function* testRemoveAndUndo() {
- if (!gExperiments) {
- info("Skipping experiments test because that feature isn't available.");
- return;
- }
-
- yield gCategoryUtilities.openType("experiment");
-
- let addon = get_addon_element(gManagerWindow, "test-experiment1@experiments.mozilla.org");
- Assert.ok(addon, "Got add-on element.");
-
- yield clickRemoveButton(addon);
- addon.parentNode.ensureElementIsVisible(addon);
-
- let el = gManagerWindow.document.getAnonymousElementByAttribute(addon, "class", "pending");
- is_element_visible(el, "Uninstall undo information should be visible.");
-
- yield clickUndoButton(addon);
- addon = get_addon_element(gManagerWindow, "test-experiment1@experiments.mozilla.org");
- Assert.ok(addon, "Got add-on element.");
-});
-
-add_task(function* testCleanup() {
- if (gExperiments) {
- Services.prefs.clearUserPref("experiments.enabled");
- Services.prefs.setCharPref("experiments.manifest.uri", gSavedManifestURI);
-
- // We perform the uninit/init cycle to purge any leftover state.
- yield OS.File.remove(gExperiments._cacheFilePath);
- yield gExperiments.uninit();
- yield gExperiments.init();
-
- Services.prefs.clearUserPref("toolkit.telemetry.enabled");
- }
-
- // Check post-conditions.
- let addons = yield getExperimentAddons();
- Assert.equal(addons.length, 0, "No experiment add-ons are installed.");
-
- yield close_manager(gManagerWindow);
-});
diff --git a/toolkit/pluginproblem/content/pluginProblemBinding.css b/toolkit/pluginproblem/content/pluginProblemBinding.css
index 48506de34..a545e3eba 100644
--- a/toolkit/pluginproblem/content/pluginProblemBinding.css
+++ b/toolkit/pluginproblem/content/pluginProblemBinding.css
@@ -19,6 +19,11 @@ object:-moz-handler-crashed,
object:-moz-handler-clicktoplay,
object:-moz-handler-vulnerable-updatable,
object:-moz-handler-vulnerable-no-update {
+%ifdef MC_PALEMOON
+ /* Initialize the overlay with visibility:hidden to prevent flickering if
+ * the plugin is too small to show the overlay */
+ visibility: hidden;
+%endif
display: inline-block;
overflow: hidden;
opacity: 1 !important;
diff --git a/toolkit/pluginproblem/content/pluginProblemContent.css b/toolkit/pluginproblem/content/pluginProblemContent.css
index 43a9f52dc..cf8755635 100644
--- a/toolkit/pluginproblem/content/pluginProblemContent.css
+++ b/toolkit/pluginproblem/content/pluginProblemContent.css
@@ -51,6 +51,7 @@ a .mainBox:focus,
line-height: initial;
}
+%ifndef MC_PALEMOON
/* Initialize the overlay with visibility:hidden to prevent flickering if
* the plugin is too small to show the overlay */
.mainBox > .hoverBox,
@@ -62,6 +63,7 @@ a .mainBox:focus,
.visible > .closeIcon {
visibility: visible;
}
+%endif
.mainBox[chromedir="rtl"] {
direction: rtl;
@@ -97,6 +99,10 @@ a .msgTapToPlay,
:-moz-handler-blocked .msgBlocked,
:-moz-handler-crashed .msgCrashed {
display: block;
+ position: relative;
+ left: 0;
+ top: 0;
+ z-index: 9999;
}
.submitStatus[status] {
diff --git a/toolkit/pluginproblem/jar.mn b/toolkit/pluginproblem/jar.mn
index d0af1c82f..c027793de 100644
--- a/toolkit/pluginproblem/jar.mn
+++ b/toolkit/pluginproblem/jar.mn
@@ -5,6 +5,6 @@
toolkit.jar:
% content pluginproblem %pluginproblem/ contentaccessible=yes
pluginproblem/pluginProblem.xml (content/pluginProblem.xml)
- pluginproblem/pluginProblemContent.css (content/pluginProblemContent.css)
- pluginproblem/pluginProblemBinding.css (content/pluginProblemBinding.css)
+* pluginproblem/pluginProblemContent.css (content/pluginProblemContent.css)
+* pluginproblem/pluginProblemBinding.css (content/pluginProblemBinding.css)
pluginproblem/pluginReplaceBinding.css (content/pluginReplaceBinding.css)
diff --git a/toolkit/profile/nsProfileLock.cpp b/toolkit/profile/nsProfileLock.cpp
index 08d109224..cc9ecb62e 100644
--- a/toolkit/profile/nsProfileLock.cpp
+++ b/toolkit/profile/nsProfileLock.cpp
@@ -30,7 +30,7 @@
#include "prenv.h"
#endif
-#if defined(MOZ_WIDGET_GONK) && !defined(MOZ_CRASHREPORTER)
+#if defined(MOZ_WIDGET_GONK)
#include <sys/syscall.h>
#endif
@@ -198,7 +198,6 @@ void nsProfileLock::FatalSignalHandler(int signo
case SIGILL:
case SIGABRT:
case SIGSEGV:
-#ifndef MOZ_CRASHREPORTER
// Retrigger the signal for those that can generate a core dump
signal(signo, SIG_DFL);
if (info->si_code <= 0) {
@@ -206,7 +205,6 @@ void nsProfileLock::FatalSignalHandler(int signo
break;
}
}
-#endif
return;
default:
break;
diff --git a/toolkit/themes/linux/global/findBar.css b/toolkit/themes/linux/global/findBar.css
index f04911402..e3e2ad086 100644
--- a/toolkit/themes/linux/global/findBar.css
+++ b/toolkit/themes/linux/global/findBar.css
@@ -7,6 +7,7 @@
findbar {
border-top: 2px solid;
-moz-border-top-colors: ThreeDShadow ThreeDHighlight;
+ padding-bottom: 1px;
min-width: 1px;
transition-property: margin-bottom, opacity, visibility;
transition-duration: 150ms, 150ms, 0s;
@@ -22,138 +23,66 @@ findbar[hidden] {
transition-delay: 0s, 0s, 150ms;
}
-findbar[noanim] {
- transition-duration: 0s !important;
- transition-delay: 0s !important;
-}
-
-.findbar-container {
- padding-inline-start: 8px;
- padding-top: 4px;
- padding-bottom: 4px;
-}
-
-.findbar-closebutton {
- -moz-appearance: none;
- width: 16px;
- height: 16px;
- margin: 0 8px;
-}
-
-/* Search field */
-
-.findbar-textbox {
- -moz-appearance: none;
- border: 1px solid ThreeDShadow;
- box-shadow: 0 0 1px 0 ThreeDShadow inset;
- margin: 0;
- padding: 5px;
- width: 14em;
-}
-
-.findbar-textbox:-moz-locale-dir(ltr) {
- border-radius: 3px 0 0 3px;
- border-right-width: 0;
-}
-
-.findbar-textbox:-moz-locale-dir(rtl) {
- border-radius: 0 3px 3px 0;
- border-left-width: 0;
-}
-
-.findbar-textbox[focused="true"] {
- border-color: Highlight;
- box-shadow: 0 0 1px 0 Highlight inset;
-}
-
-.findbar-textbox[status="notfound"] {
- background-color: #f66;
- color: white;
-}
-
-.findbar-textbox[flash="true"] {
- background-color: yellow;
- color: black;
-}
-
-.findbar-textbox.minimal {
- border-width: 1px;
- border-radius: 3px;
-}
-
-.findbar-find-previous,
-.findbar-find-next {
- margin-inline-start: 0;
- -moz-appearance: none;
- background: linear-gradient(rgba(255,255,255,.8) 1px, rgba(255,255,255,.4) 1px, rgba(255,255,255,.1));
- border: 1px solid ThreeDShadow;
- padding: 5px 9px;
- line-height: 1em;
-}
+/* find-next button */
-.findbar-find-previous:focus,
-.findbar-find-next:focus {
- border-color: Highlight;
- box-shadow: 0 0 1px 0 Highlight inset;
+.findbar-find-next > .toolbarbutton-icon {
+ -moz-appearance: button-arrow-next;
}
-.findbar-find-previous:not([disabled]):active,
-.findbar-find-next:not([disabled]):active {
- background: rgba(23,50,76,.2);
- border: 1px solid ThreeDShadow;
- box-shadow: 0 1px 2px rgba(10,31,51,.2) inset;
-}
+/* find-previous button */
-.findbar-find-previous {
- list-style-image: url(chrome://global/skin/icons/find-arrows.svg#glyph-find-previous);
- border-inline-end-width: 0;
+.findbar-find-previous > .toolbarbutton-icon {
+ -moz-appearance: button-arrow-previous;
}
-.findbar-find-next {
- list-style-image: url(chrome://global/skin/icons/find-arrows.svg#glyph-find-next);
-}
+/* highlight button */
-.findbar-find-previous > .toolbarbutton-icon,
-.findbar-find-next > .toolbarbutton-icon {
- margin: 0;
+.findbar-highlight {
+ list-style-image: url("chrome://global/skin/icons/find.png");
+ -moz-image-region: rect(0px, 16px, 16px, 0px);
}
-.findbar-find-previous[disabled="true"] > .toolbarbutton-icon,
-.findbar-find-next[disabled="true"] > .toolbarbutton-icon {
- opacity: .5;
+.findbar-highlight[disabled="true"] {
+ -moz-image-region: rect(16px, 16px, 32px, 0px);
}
-.findbar-find-next:-moz-locale-dir(ltr) {
- border-top-right-radius: 2px;
- border-bottom-right-radius: 2px;
+.find-status-icon {
+ list-style-image: none;
+ margin-top: 2px;
+ margin-bottom: 0;
+ -moz-margin-start: 12px;
+ -moz-margin-end: 0;
+ width: 16px;
+ height: 16px;
}
-.findbar-find-next:-moz-locale-dir(rtl) {
- border-top-left-radius: 2px;
- border-bottom-left-radius: 2px;
+.findbar-find-status,
+.findbar-matches {
+ margin-top: 0 !important;
+ margin-bottom: 0 !important;
+ -moz-margin-start: 3px !important;
+ -moz-margin-end: 0 !important;
+ padding: 2px !important;
}
-.findbar-find-previous:focus + .findbar-find-next {
- border-inline-start-width: 0;
+.find-status-icon[status="notfound"] {
+ list-style-image: url("moz-icon://stock/gtk-dialog-error?size=menu");
}
-.findbar-find-previous:focus {
- border-inline-end-width: 1px;
+.find-status-icon[status="pending"] {
+ list-style-image: url("chrome://global/skin/icons/loading_16.png");
}
-.findbar-highlight,
-.findbar-case-sensitive,
-.findbar-entire-word {
- margin-inline-start: 5px;
+.findbar-textbox[status="notfound"] {
+ box-shadow: 0 0 0 1em #f66 inset;
+ color: white;
}
-.findbar-find-status,
-.findbar-matches {
- color: GrayText;
- margin: 0 !important;
- margin-inline-start: 12px !important;
+.findbar-textbox[flash="true"] {
+ box-shadow: 0 0 0 1em yellow inset;
+ color: black;
}
-.find-status-icon[status="pending"] {
- list-style-image: url("chrome://global/skin/icons/loading.png");
+.find-status-icon[status="wrapped"] {
+ list-style-image: url("chrome://global/skin/icons/wrap.png");
}
diff --git a/toolkit/themes/linux/global/icons/find.png b/toolkit/themes/linux/global/icons/find.png
new file mode 100644
index 000000000..cceed403e
--- /dev/null
+++ b/toolkit/themes/linux/global/icons/find.png
Binary files differ
diff --git a/toolkit/themes/linux/global/inContentUI.css b/toolkit/themes/linux/global/inContentUI.css
new file mode 100644
index 000000000..afcef9274
--- /dev/null
+++ b/toolkit/themes/linux/global/inContentUI.css
@@ -0,0 +1,41 @@
+/* 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/. */
+
+/*
+ * The default namespace for this file is XUL. Be sure to prefix rules that
+ * are applicable to both XUL and HTML with '*|'.
+ */
+@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
+@namespace html url("http://www.w3.org/1999/xhtml");
+
+/* Page background */
+*|*:root {
+ -moz-appearance: none;
+ padding: 18px;
+ background-color: Window;
+ background-image: /* Texture */
+ url("chrome://global/skin/inContentUI/background-texture.png");
+ color: WindowText;
+}
+
+/* Use the new in-content colors for #contentAreaDownloadsView. After landing
+ of bug 989469 the colors can be moved to *|*:root */
+*|*#contentAreaDownloadsView {
+ background: #f1f1f1;
+ color: #424e5a;
+}
+
+html|html {
+ font: message-box;
+}
+
+/* Content */
+*|*.main-content {
+ /* Needed to allow the radius to clip the inner content, see bug 595656 */
+ overflow: hidden;
+ background-color: -moz-Field;
+ color: -moz-FieldText;
+ border: 1px solid ThreeDShadow;
+ border-radius: 5px;
+}
diff --git a/toolkit/themes/linux/global/jar.mn b/toolkit/themes/linux/global/jar.mn
index 5bde219fd..0efc8c5cf 100644
--- a/toolkit/themes/linux/global/jar.mn
+++ b/toolkit/themes/linux/global/jar.mn
@@ -16,6 +16,7 @@ toolkit.jar:
skin/classic/global/findBar.css
skin/classic/global/global.css
skin/classic/global/groupbox.css
+ skin/classic/global/inContentUI.css
skin/classic/global/listbox.css
skin/classic/global/menu.css
skin/classic/global/menulist.css
@@ -43,6 +44,7 @@ toolkit.jar:
skin/classic/global/icons/blacklist_favicon.png (icons/blacklist_favicon.png)
skin/classic/global/icons/blacklist_large.png (icons/blacklist_large.png)
skin/classic/global/icons/close.svg (icons/close.svg)
+ skin/classic/global/icons/find.png (icons/find.png)
skin/classic/global/icons/resizer.png (icons/resizer.png)
skin/classic/global/icons/sslWarning.png (icons/sslWarning.png)
@@ -52,6 +54,6 @@ toolkit.jar:
skin/classic/global/tree/twisty-clsd.png (tree/twisty-clsd.png)
skin/classic/global/tree/twisty-open.png (tree/twisty-open.png)
- skin/classic/global/console/console.css (console/console.css)
- skin/classic/global/console/console.png (console/console.png)
- skin/classic/global/console/console-toolbar.png (console/console-toolbar.png)
+ skin/classic/global/console/console.css (console/console.css)
+ skin/classic/global/console/console.png (console/console.png)
+ skin/classic/global/console/console-toolbar.png (console/console-toolbar.png)
diff --git a/toolkit/themes/linux/mozapps/jar.mn b/toolkit/themes/linux/mozapps/jar.mn
index d4997d36c..37325c0be 100644
--- a/toolkit/themes/linux/mozapps/jar.mn
+++ b/toolkit/themes/linux/mozapps/jar.mn
@@ -23,30 +23,33 @@ toolkit.jar:
* skin/classic/mozapps/extensions/newaddon.css (webextensions/newaddon.css)
skin/classic/mozapps/extensions/heart.png (webextensions/heart.png)
#else
-+ skin/classic/mozapps/extensions/extensions.css (extensions/extensions.css)
-+ skin/classic/mozapps/extensions/category-search.png (extensions/category-search.png)
-+ skin/classic/mozapps/extensions/category-discover.png (extensions/category-discover.png)
-+ skin/classic/mozapps/extensions/category-languages.png (extensions/localeGeneric.png)
-+ skin/classic/mozapps/extensions/category-extensions.png (extensions/extensionGeneric.png)
-+ skin/classic/mozapps/extensions/category-themes.png (extensions/themeGeneric.png)
-+ skin/classic/mozapps/extensions/category-plugins.png (extensions/category-plugins.png)
-+ skin/classic/mozapps/extensions/category-service.png (extensions/category-service.png)
-+ skin/classic/mozapps/extensions/category-dictionaries.png (extensions/category-dictionaries.png)
-+ skin/classic/mozapps/extensions/category-experiments.png (extensions/category-experiments.png)
-+ skin/classic/mozapps/extensions/category-recent.png (extensions/category-recent.png)
-+ skin/classic/mozapps/extensions/category-available.png (extensions/category-available.png)
-+ skin/classic/mozapps/extensions/extensionGeneric.png (extensions/extensionGeneric.png)
-+ skin/classic/mozapps/extensions/extensionGeneric-16.png (extensions/extensionGeneric-16.png)
-+ skin/classic/mozapps/extensions/dictionaryGeneric.png (extensions/dictionaryGeneric.png)
-+ skin/classic/mozapps/extensions/dictionaryGeneric-16.png (extensions/dictionaryGeneric-16.png)
-+ skin/classic/mozapps/extensions/experimentGeneric.png (extensions/experimentGeneric.png)
-+ skin/classic/mozapps/extensions/themeGeneric.png (extensions/themeGeneric.png)
-+ skin/classic/mozapps/extensions/themeGeneric-16.png (extensions/themeGeneric-16.png)
-+ skin/classic/mozapps/extensions/localeGeneric.png (extensions/localeGeneric.png)
-+ skin/classic/mozapps/extensions/newaddon.css (extensions/newaddon.css)
-+ skin/classic/mozapps/extensions/selectAddons.css (extensions/selectAddons.css)
-+ skin/classic/mozapps/xpinstall/xpinstallItemGeneric.png (extensions/extensionGeneric.png)
+ skin/classic/mozapps/extensions/extensions.css (extensions/extensions.css)
+ skin/classic/mozapps/extensions/category-search.png (extensions/category-search.png)
+ skin/classic/mozapps/extensions/category-discover.png (extensions/category-discover.png)
+ skin/classic/mozapps/extensions/category-languages.png (extensions/localeGeneric.png)
+ skin/classic/mozapps/extensions/category-extensions.png (extensions/extensionGeneric.png)
+ skin/classic/mozapps/extensions/category-themes.png (extensions/themeGeneric.png)
+ skin/classic/mozapps/extensions/category-plugins.png (extensions/category-plugins.png)
+ skin/classic/mozapps/extensions/category-service.png (extensions/category-service.png)
+ skin/classic/mozapps/extensions/category-dictionaries.png (extensions/category-dictionaries.png)
+ skin/classic/mozapps/extensions/category-experiments.png (extensions/category-experiments.png)
+ skin/classic/mozapps/extensions/category-recent.png (extensions/category-recent.png)
+ skin/classic/mozapps/extensions/category-available.png (extensions/category-available.png)
+ skin/classic/mozapps/extensions/extensionGeneric.png (extensions/extensionGeneric.png)
+ skin/classic/mozapps/extensions/extensionGeneric-16.png (extensions/extensionGeneric-16.png)
+ skin/classic/mozapps/extensions/dictionaryGeneric.png (extensions/dictionaryGeneric.png)
+ skin/classic/mozapps/extensions/dictionaryGeneric-16.png (extensions/dictionaryGeneric-16.png)
+ skin/classic/mozapps/extensions/experimentGeneric.png (extensions/experimentGeneric.png)
+ skin/classic/mozapps/extensions/themeGeneric.png (extensions/themeGeneric.png)
+ skin/classic/mozapps/extensions/themeGeneric-16.png (extensions/themeGeneric-16.png)
+ skin/classic/mozapps/extensions/localeGeneric.png (extensions/localeGeneric.png)
+ skin/classic/mozapps/extensions/newaddon.css (extensions/newaddon.css)
+ skin/classic/mozapps/extensions/selectAddons.css (extensions/selectAddons.css)
+ skin/classic/mozapps/xpinstall/xpinstallItemGeneric.png (extensions/extensionGeneric.png)
#endif
+ skin/classic/mozapps/passwordmgr/key.png (passwordmgr/key.png)
+ skin/classic/mozapps/passwordmgr/key-16.png (passwordmgr/key-16.png)
+ skin/classic/mozapps/passwordmgr/key-64.png (passwordmgr/key-64.png)
skin/classic/mozapps/plugins/pluginGeneric.png (plugins/pluginGeneric.png)
skin/classic/mozapps/plugins/pluginBlocked.png (plugins/pluginBlocked.png)
skin/classic/mozapps/plugins/pluginGeneric-16.png (plugins/pluginGeneric-16.png)
diff --git a/toolkit/themes/linux/mozapps/passwordmgr/key-16.png b/toolkit/themes/linux/mozapps/passwordmgr/key-16.png
new file mode 100644
index 000000000..ac135b847
--- /dev/null
+++ b/toolkit/themes/linux/mozapps/passwordmgr/key-16.png
Binary files differ
diff --git a/toolkit/themes/linux/mozapps/passwordmgr/key-64.png b/toolkit/themes/linux/mozapps/passwordmgr/key-64.png
new file mode 100644
index 000000000..0fb69f382
--- /dev/null
+++ b/toolkit/themes/linux/mozapps/passwordmgr/key-64.png
Binary files differ
diff --git a/toolkit/themes/linux/mozapps/passwordmgr/key.png b/toolkit/themes/linux/mozapps/passwordmgr/key.png
new file mode 100644
index 000000000..b5e8afefc
--- /dev/null
+++ b/toolkit/themes/linux/mozapps/passwordmgr/key.png
Binary files differ
diff --git a/toolkit/themes/osx/global/findBar.css b/toolkit/themes/osx/global/findBar.css
index 4e775292f..44983d80f 100644
--- a/toolkit/themes/osx/global/findBar.css
+++ b/toolkit/themes/osx/global/findBar.css
@@ -9,6 +9,7 @@ findbar {
background: @scopeBarBackground@;
border-top: @scopeBarSeparatorBorder@;
min-width: 1px;
+ padding: 4px 2px;
transition-property: margin-bottom, opacity, visibility;
transition-duration: 150ms, 150ms, 0s;
transition-timing-function: ease-in-out, ease-in-out, linear;
@@ -23,27 +24,16 @@ findbar[hidden] {
transition-delay: 0s, 0s, 150ms;
}
-findbar[noanim] {
- transition-duration: 0s !important;
- transition-delay: 0s !important;
-}
-
findbar:-moz-lwtheme {
-moz-appearance: none;
background: none;
border-style: none;
}
-.findbar-container {
- padding-inline-start: 2px;
- padding-top: 4px;
- padding-bottom: 4px;
-}
-
label.findbar-find-fast {
+ margin: 1px 3px 0 !important;
color: @scopeBarTitleColor@;
- margin: 0;
- margin-inline-start: 12px;
+ font-weight: bold;
text-shadow: @loweredShadow@;
}
@@ -54,15 +44,20 @@ label.findbar-find-fast:-moz-lwtheme,
}
.findbar-closebutton {
- margin-inline-start: 4px;
- padding-inline-start: 0;
- padding-inline-end: 8px;
+ padding: 0;
+ margin: 0 4px;
border: none;
- /* make sure the closebutton is displayed as the first element in the bar: */
- -moz-box-ordinal-group: 0;
+}
+
+.findbar-closebutton:-moz-lwtheme-brighttext {
+ list-style-image: url("chrome://global/skin/icons/close-inverted.png");
}
@media (min-resolution: 2dppx) {
+ .findbar-closebutton:-moz-lwtheme-brighttext {
+ list-style-image: url("chrome://global/skin/icons/close-inverted@2x.png");
+ }
+
.findbar-closebutton > .toolbarbutton-icon {
width: 16px;
}
@@ -70,109 +65,124 @@ label.findbar-find-fast:-moz-lwtheme,
.findbar-find-next,
.findbar-find-previous,
-.findbar-highlight,
-.findbar-case-sensitive,
-.findbar-entire-word {
+.findbar-highlight {
+ margin: 0 4px;
+ padding: 1px 3px;
-moz-appearance: none;
border-radius: 10000px;
border: @roundButtonBorder@;
background: @roundButtonBackground@;
box-shadow: @roundButtonShadow@;
color: buttontext;
- margin: 0;
}
-@media (-moz-mac-yosemite-theme) {
- .findbar-find-previous,
- .findbar-find-next {
- border-radius: 3px;
- box-shadow: none;
- }
-}
-
-.findbar-highlight,
-.findbar-case-sensitive,
-.findbar-entire-word {
- margin-inline-end: 5px;
- padding: 2px 9px;
-}
-
-.findbar-highlight {
- margin-inline-start: 8px;
-}
-
-.findbar-container > toolbarbutton:-moz-focusring,
-.findbar-find-next:-moz-focusring,
-.findbar-find-previous:-moz-focusring {
+.findbar-container > toolbarbutton:-moz-focusring {
position: relative;
box-shadow: @focusRingShadow@, @roundButtonShadow@;
}
+.findbar-container > toolbarbutton > .toolbarbutton-text {
+ margin: 0 6px !important;
+}
+
.findbar-container > toolbarbutton[disabled] {
color: GrayText !important;
}
.findbar-find-next:not([disabled]):hover:active,
.findbar-find-previous:not([disabled]):hover:active,
-.findbar-highlight:not([disabled]):hover:active,
-.findbar-case-sensitive:not([disabled]):hover:active,
-.findbar-entire-word:not([disabled]):hover:active,
-.findbar-highlight:not([disabled])[checked="true"],
-.findbar-case-sensitive:not([disabled])[checked="true"],
-.findbar-entire-word:not([disabled])[checked="true"] {
+.findbar-highlight:not([disabled]):hover:active {
text-shadow: @loweredShadow@;
background: @roundButtonPressedBackground@;
box-shadow: @roundButtonPressedShadow@;
}
-.findbar-find-next:hover:active:-moz-focusring,
-.findbar-find-previous:hover:active:-moz-focusring {
+.findbar-container > toolbarbutton:hover:active:-moz-focusring {
text-shadow: @loweredShadow@;
background: @roundButtonPressedBackground@;
box-shadow: @focusRingShadow@, @roundButtonPressedShadow@;
}
-@media (-moz-mac-yosemite-theme) {
- .findbar-container > toolbarbutton:-moz-focusring,
- .findbar-find-next:-moz-focusring,
- .findbar-find-previous:-moz-focusring {
- box-shadow: @yosemiteFocusRingShadow@, @roundButtonShadow@;
+.findbar-closebutton > .toolbarbutton-text {
+ display: none;
+}
+
+/* Match case checkbox */
+
+.findbar-container > checkbox {
+ list-style-image: url("chrome://global/skin/icons/checkbox.png");
+ -moz-image-region: rect(0px 16px 16px 0px);
+ -moz-appearance: none;
+ margin: 0 2px;
+ -moz-margin-start: 7px;
+}
+
+.findbar-container > checkbox:hover:active {
+ -moz-image-region: rect(0px 32px 16px 16px);
+}
+.findbar-container > checkbox[checked] {
+ -moz-image-region: rect(0px 48px 16px 32px);
+}
+.findbar-container > checkbox[checked]:hover:active {
+ -moz-image-region: rect(0px 64px 16px 48px);
+}
+
+@media (min-resolution: 2dppx) {
+ .findbar-container > checkbox {
+ list-style-image: url("chrome://global/skin/icons/checkbox@2x.png");
+ -moz-image-region: rect(0px 32px 32px 0px);
}
- .findbar-find-next:hover:active:-moz-focusring,
- .findbar-find-previous:hover:active:-moz-focusring {
- box-shadow: @yosemiteFocusRingShadow@, @roundButtonPressedShadow@;
+ .findbar-container > checkbox:hover:active {
+ -moz-image-region: rect(0px 64px 32px 32px);
+ }
+ .findbar-container > checkbox[checked] {
+ -moz-image-region: rect(0px 96px 32px 64px);
+ }
+ .findbar-container > checkbox[checked]:hover:active {
+ -moz-image-region: rect(0px 128px 32px 96px);
}
}
-/* Search field */
-.findbar-textbox {
- position: relative;
- -moz-appearance: none;
- border: @roundButtonBorder@;
- border-radius: 10000px 0 0 10000px;
- box-shadow: @roundButtonShadow@;
- background: url("chrome://global/skin/icons/search-textbox.svg") -moz-Field no-repeat 5px center;
- margin: 0;
- padding: 2px 8px;
- padding-inline-start: 19px;
+
+.findbar-container > checkbox > .checkbox-check {
+ display: none;
}
-.findbar-textbox:-moz-locale-dir(rtl) {
- border-radius: 0 10000px 10000px 0;
+.findbar-container > checkbox > .checkbox-label-box > .checkbox-label {
+ margin: 0 !important;
+ padding: 2px 0 0;
}
-@media (-moz-mac-yosemite-theme) {
- .findbar-textbox {
- border-top-left-radius: 3px;
- border-bottom-left-radius: 3px;
- box-shadow: none;
+.findbar-container > checkbox > .checkbox-label-box > .checkbox-icon {
+ -moz-padding-start: 1px;
+ padding-bottom: 1px;
+}
+@media (min-resolution: 2dppx) {
+ .findbar-container > checkbox > .checkbox-label-box > .checkbox-icon {
+ width: 17px;
+ height: 17px;
}
+}
- .findbar-textbox:-moz-locale-dir(rtl) {
- border-radius: 0 3px 3px 0;
- }
+.findbar-container > checkbox:-moz-focusring > .checkbox-label-box > .checkbox-icon {
+ border-radius: 4px;
+ box-shadow: @focusRingShadow@;
+}
+
+/* Search field */
+
+.findbar-textbox {
+ -moz-appearance: none;
+ border-radius: 10000px;
+ border: none;
+ box-shadow: 0 1px 1.5px rgba(0, 0, 0, .7) inset,
+ 0 0 0 1px rgba(0, 0, 0, .17) inset;
+ background: url("chrome://global/skin/icons/search-textbox.png") -moz-Field no-repeat 5px center;
+ margin: 0 4px -1px;
+ padding: 3px 8px 2px;
+ -moz-padding-start: 19px;
}
.findbar-textbox:not([focused="true"]):-moz-lwtheme {
@@ -180,13 +190,8 @@ label.findbar-find-fast:-moz-lwtheme,
}
.findbar-textbox[focused="true"] {
- box-shadow: @focusRingShadow@;
-}
-
-@media (-moz-mac-yosemite-theme) {
- .findbar-textbox[focused="true"] {
- box-shadow: @yosemiteFocusRingShadow@;
- }
+ box-shadow: @focusRingShadow@,
+ 0 1px 1.5px rgba(0, 0, 0, .8) inset;
}
.findbar-textbox[flash="true"] {
@@ -198,48 +203,52 @@ label.findbar-find-fast:-moz-lwtheme,
color: #FFF;
}
-.findbar-textbox.minimal {
- border-radius: 10000px;
- margin-inline-start: 5px;
-}
-
-/* Find previous/next buttons */
+/* find-next button */
-.findbar-find-previous,
.findbar-find-next {
- margin-inline-start: 0;
- padding: 3px 6px 1px;
+ -moz-border-end: none;
+ -moz-margin-end: 0 !important;
}
-.findbar-find-previous > .toolbarbutton-icon,
-.findbar-find-next > .toolbarbutton-icon {
- margin: 0;
+.findbar-find-next:-moz-locale-dir(ltr),
+.findbar-find-previous:-moz-locale-dir(rtl) {
+ border-top-right-radius: 0px;
+ border-bottom-right-radius: 0px;
}
+/* find-previous button */
+
.findbar-find-previous {
- border-left: none;
- border-right: none;
- margin-inline-end: 0;
- list-style-image: url(chrome://global/skin/icons/find-arrows.svg#glyph-find-previous);
- border-radius: 0;
+ -moz-margin-start: 0 !important;
}
-.findbar-find-next {
- list-style-image: url(chrome://global/skin/icons/find-arrows.svg#glyph-find-next);
- padding-inline-end: 7px;
+.findbar-find-previous:-moz-locale-dir(ltr),
+.findbar-find-next:-moz-locale-dir(rtl) {
+ border-top-left-radius: 0px;
+ border-bottom-left-radius: 0px;
}
-.findbar-find-next:-moz-locale-dir(ltr) {
- border-top-left-radius: 0;
- border-bottom-left-radius: 0;
+/* highlight button */
+
+.findbar-highlight {
+ -moz-margin-start: 8px;
}
-.findbar-find-next:-moz-locale-dir(rtl) {
- border-top-right-radius: 0;
- border-bottom-right-radius: 0;
+.findbar-highlight > .toolbarbutton-icon {
+ width: 13px;
+ height: 8px;
+ margin: 0 4px;
+ -moz-margin-end: 0;
+ border: 1px solid #818181;
+ border-radius: 4px;
+ background-color: #F4F4F3;
}
-/* Status description */
+
+.findbar-highlight[checked="true"] > .toolbarbutton-icon {
+ background-color: #FFFF00;
+ border-color: #818100;
+}
.find-status-icon {
display: none;
@@ -247,20 +256,14 @@ label.findbar-find-fast:-moz-lwtheme,
.find-status-icon[status="pending"] {
display: block;
- list-style-image: url("chrome://global/skin/icons/loading.png");
-}
-
-@media (min-resolution: 2dppx) {
- .find-status-icon[status="pending"] {
- width: 16px;
- list-style-image: url("chrome://global/skin/icons/loading@2x.png");
- }
+ list-style-image: url("chrome://global/skin/icons/loading_16.png");
}
.findbar-find-status,
.found-matches {
- color: rgba(0,0,0,.5);
- margin: 0 !important;
- margin-inline-start: 12px !important;
- text-shadow: 0 1px rgba(255,255,255,.4);
+ color: #436599;
+ font-weight: bold;
+ text-shadow: 0 1px rgba(255, 255, 255, .4);
+ margin: 1px 1px 0 !important;
+ -moz-margin-start: 12px !important;
}
diff --git a/toolkit/themes/osx/global/inContentUI.css b/toolkit/themes/osx/global/inContentUI.css
new file mode 100644
index 000000000..17e2e6ae3
--- /dev/null
+++ b/toolkit/themes/osx/global/inContentUI.css
@@ -0,0 +1,144 @@
+/* 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/. */
+
+%include shared.inc
+
+/*
+ * The default namespace for this file is XUL. Be sure to prefix rules that
+ * are applicable to both XUL and HTML with '*|'.
+ */
+@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
+@namespace html url("http://www.w3.org/1999/xhtml");
+
+/* Page background */
+*|*:root {
+ -moz-appearance: none;
+ padding: 18px;
+ background-image: /* Texture */
+ url("chrome://global/skin/inContentUI/background-texture.png"),
+ /* Gradient */
+ linear-gradient(#ADB5C2, #BFC6D1);
+}
+
+/* Use the new in-content colors for #contentAreaDownloadsView. After landing
+ of bug 989469 the colors can be moved to *|*:root */
+*|*#contentAreaDownloadsView {
+ background: #f1f1f1;
+ color: #424e5a;
+}
+
+html|html {
+ font: message-box;
+}
+
+/* Content */
+*|*.main-content {
+ /* Needed to allow the radius to clip the inner content, see bug 595656 */
+ overflow: hidden;
+ background-image: linear-gradient(rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0.25) 50%, rgba(255, 255, 255, 0.05));
+ border: 1px solid rgba(50, 65, 92, 0.4);
+ border-radius: 5px;
+}
+
+/* Buttons */
+*|button,
+menulist,
+colorpicker[type="button"] {
+ -moz-appearance: none;
+ padding: 1px 4px;
+ min-width: 60px;
+ border-radius: 3px;
+ border: 1px solid rgba(60,73,97,0.5);
+ box-shadow: inset 0 1px rgba(255,255,255,0.25), 0 1px rgba(255,255,255,0.25);
+ background-color: transparent;
+ background-image: linear-gradient(rgba(255,255,255,0.45), rgba(255,255,255,0.2));
+ background-clip: padding-box;
+ color: #252F3B;
+ text-shadow: @loweredShadow@;
+}
+
+button:-moz-focusring > .button-box,
+menulist:-moz-focusring:not([open="true"]) > .menulist-label-box,
+colorpicker[type="button"]:-moz-focusring:not([open="true"]) > .colorpicker-button-colorbox {
+ outline: 1px dotted #252F3B;
+}
+
+html|button[disabled],
+button[disabled="true"],
+menulist[disabled="true"],
+colorpicker[type="button"][disabled="true"] {
+ opacity: 0.8;
+ color: #505050;
+}
+
+html|button:not([disabled]):active:hover,
+button:not([disabled="true"]):active:hover,
+menulist[open="true"]:not([disabled="true"]),
+colorpicker[type="button"][open="true"]:not([disabled="true"]) {
+ box-shadow: inset 0 1px 3px rgba(0,0,0,.2), 0 1px rgba(255,255,255,0.25);
+ background-image: linear-gradient(rgba(45,54,71,0.3), rgba(45,54,71,0.1));
+ border-color: rgba(60,73,97,0.7);
+}
+
+menulist {
+ -moz-padding-end: 0;
+ margin-left: 5px;
+ margin-right: 5px;
+}
+
+/* Tweak margins so the focus ring is in the right place. */
+menulist > .menulist-label-box {
+ -moz-margin-end: 3px;
+ margin-top: 1px;
+}
+
+menulist > .menulist-label-box > .menulist-label {
+ margin-top: 0px !important;
+ margin-bottom: 0px !important;
+}
+
+menulist > .menulist-dropmarker {
+ -moz-appearance: none;
+ display: -moz-box;
+ background: transparent;
+ border: none;
+ -moz-border-start: 1px solid rgba(60,73,97,0.5);
+ margin-top: -1px;
+ margin-bottom: -1px;
+}
+
+colorpicker[type="button"] {
+ margin: 1px 5px 2px 5px;
+ padding: 3px;
+ height: 25px;
+}
+
+spinbuttons {
+ -moz-appearance: none;
+}
+
+spinbuttons > .spinbuttons-box > .spinbuttons-button {
+ min-width: 12px;
+}
+
+.spinbuttons-button > .button-box > .button-text {
+ display: none;
+}
+
+.spinbuttons-button[disabled="true"] > .button-box > .button-icon {
+ opacity: 0.5;
+}
+
+spinbuttons > .spinbuttons-box > .spinbuttons-up {
+ list-style-image: url("chrome://global/skin/arrow/arrow-up.gif");
+ border-bottom-width: 0;
+ border-bottom-left-radius: 0;
+ border-bottom-right-radius: 0;
+}
+
+spinbuttons > .spinbuttons-box > .spinbuttons-down {
+ list-style-image: url("chrome://global/skin/arrow/arrow-dn.gif");
+ border-top-left-radius: 0;
+ border-top-right-radius: 0;
+}
diff --git a/toolkit/themes/osx/global/jar.mn b/toolkit/themes/osx/global/jar.mn
index 79bb062ab..9407ccee5 100644
--- a/toolkit/themes/osx/global/jar.mn
+++ b/toolkit/themes/osx/global/jar.mn
@@ -21,6 +21,7 @@ toolkit.jar:
* skin/classic/global/findBar.css
* skin/classic/global/global.css
skin/classic/global/groupbox.css
+* skin/classic/global/inContentUI.css
skin/classic/global/linkTree.css
skin/classic/global/listbox.css
skin/classic/global/menu.css
diff --git a/toolkit/themes/osx/mozapps/jar.mn b/toolkit/themes/osx/mozapps/jar.mn
index 35927755b..f8ade11d9 100644
--- a/toolkit/themes/osx/mozapps/jar.mn
+++ b/toolkit/themes/osx/mozapps/jar.mn
@@ -83,6 +83,9 @@ toolkit.jar:
skin/classic/mozapps/extensions/blocklist.css (extensions/blocklist.css)
* skin/classic/mozapps/extensions/newaddon.css (extensions/newaddon.css)
#endif
+ skin/classic/mozapps/passwordmgr/key.png (passwordmgr/key.png)
+ skin/classic/mozapps/passwordmgr/key-16.png (passwordmgr/key-16.png)
+ skin/classic/mozapps/passwordmgr/key-64.png (passwordmgr/key-64.png)
skin/classic/mozapps/plugins/notifyPluginGeneric.png (plugins/notifyPluginGeneric.png)
skin/classic/mozapps/plugins/pluginGeneric.png (plugins/pluginGeneric.png)
skin/classic/mozapps/plugins/pluginBlocked.png (plugins/pluginBlocked.png)
diff --git a/toolkit/themes/osx/mozapps/passwordmgr/key-16.png b/toolkit/themes/osx/mozapps/passwordmgr/key-16.png
new file mode 100644
index 000000000..ac135b847
--- /dev/null
+++ b/toolkit/themes/osx/mozapps/passwordmgr/key-16.png
Binary files differ
diff --git a/toolkit/themes/osx/mozapps/passwordmgr/key-64.png b/toolkit/themes/osx/mozapps/passwordmgr/key-64.png
new file mode 100644
index 000000000..0fb69f382
--- /dev/null
+++ b/toolkit/themes/osx/mozapps/passwordmgr/key-64.png
Binary files differ
diff --git a/toolkit/themes/osx/mozapps/passwordmgr/key.png b/toolkit/themes/osx/mozapps/passwordmgr/key.png
new file mode 100644
index 000000000..b5e8afefc
--- /dev/null
+++ b/toolkit/themes/osx/mozapps/passwordmgr/key.png
Binary files differ
diff --git a/toolkit/themes/shared/about.css b/toolkit/themes/shared/about.css
index 25f52992a..5c40dbfea 100644
--- a/toolkit/themes/shared/about.css
+++ b/toolkit/themes/shared/about.css
@@ -26,8 +26,8 @@ body {
}
#aboutLogoContainer {
- border: 1px solid ThreeDLightShadow;
width: 300px;
+ margin: 0 auto;
margin-bottom: 2em;
}
@@ -35,12 +35,6 @@ img {
border: 0;
}
-#version {
- font-weight: bold;
- color: #909090;
- margin: -24px 0 9px 17px;
-}
-
ul {
margin: 0;
margin-inline-start: 1.5em;
diff --git a/toolkit/themes/shared/datetimeinputpickers.css b/toolkit/themes/shared/datetimeinputpickers.css
new file mode 100644
index 000000000..f0c4315e5
--- /dev/null
+++ b/toolkit/themes/shared/datetimeinputpickers.css
@@ -0,0 +1,377 @@
+/* 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/. */
+
+:root {
+ --font-size-default: 1.1rem;
+ --spinner-width: 3rem;
+ --spinner-margin-top-bottom: 0.4rem;
+ --spinner-item-height: 2.4rem;
+ --spinner-item-margin-bottom: 0.1rem;
+ --spinner-button-height: 1.2rem;
+ --colon-width: 2rem;
+ --day-period-spacing-width: 1rem;
+ --calendar-width: 23.1rem;
+ --date-picker-item-height: 2.5rem;
+ --date-picker-item-width: 3.3rem;
+
+ --border: 0.1rem solid #D6D6D6;
+ --border-radius: 0.3rem;
+ --border-active-color: #B1B1B1;
+
+ --font-color: #191919;
+ --fill-color: #EBEBEB;
+
+ --today-fill-color: rgb(212, 212, 212);
+
+ --selected-font-color: #FFFFFF;
+ --selected-fill-color: #0996F8;
+
+ --button-font-color: #858585;
+ --button-font-color-hover: #4D4D4D;
+ --button-font-color-active: #191919;
+ --button-fill-color-active: #D4D4D4;
+
+ --weekday-header-font-color: #6C6C6C;
+ --weekend-header-font-color: rgb(218, 78, 68);
+
+ --weekend-font-color: rgb(218, 78, 68);
+ --weekday-outside-font-color: rgb(153, 153, 153);
+ --weekend-outside-font-color: rgb(255, 152, 143);
+
+ --weekday-disabled-font-color: rgba(25, 25, 25, 0.2);
+ --weekend-disabled-font-color: rgba(218, 78, 68, 0.2);
+ --disabled-fill-color: rgba(235, 235, 235, 0.8);
+
+ --disabled-opacity: 0.2;
+}
+
+html {
+ font-size: 10px;
+}
+
+body {
+ margin: 0;
+ color: var(--font-color);
+ font: message-box;
+ font-size: var(--font-size-default);
+}
+
+button {
+ -moz-appearance: none;
+ background: none;
+ border: none;
+}
+
+.nav {
+ display: flex;
+ width: var(--calendar-width);
+ height: 2.4rem;
+ margin-bottom: 0.8rem;
+ justify-content: space-between;
+}
+
+.nav > button {
+ width: 3rem;
+ height: var(--date-picker-item-height);
+ background-color: var(--button-font-color);
+}
+
+.nav > button:hover {
+ background-color: var(--button-font-color-hover);
+}
+
+.nav > button.active {
+ background-color: var(--button-font-color-active);
+}
+
+.nav > button.left {
+ background: url("chrome://global/skin/icons/calendar-arrows.svg#left") no-repeat 50% 50%;
+}
+
+.nav > button.right {
+ background: url("chrome://global/skin/icons/calendar-arrows.svg#right") no-repeat 50% 50%;
+}
+
+.month-year-container {
+ position: absolute;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ top: 0;
+ left: 3rem;
+ width: 17.1rem;
+ height: var(--date-picker-item-height);
+ z-index: 10;
+}
+
+button.month-year {
+ font-size: 1.3rem;
+ border: var(--border);
+ border-radius: 0.3rem;
+ padding: 0.2rem 2.6rem 0.2rem 1.2rem;
+}
+
+button.month-year:hover {
+ background: var(--fill-color);
+}
+
+button.month-year.active {
+ border-color: var(--border-active-color);
+ background: var(--button-fill-color-active);
+}
+
+button.month-year::after {
+ position: absolute;
+ content: "";
+ width: 2.6rem;
+ height: 1.6rem;
+ background: url("chrome://global/skin/icons/spinner-arrows.svg#down") no-repeat 50% 50%;
+}
+
+button.month-year.active::after {
+ background: url("chrome://global/skin/icons/spinner-arrows.svg#up") no-repeat 50% 50%;
+}
+
+.month-year-view {
+ position: absolute;
+ z-index: 5;
+ padding-top: 3.2rem;
+ top: 0;
+ left: 0;
+ bottom: 0;
+ width: var(--calendar-width);
+ background: window;
+ opacity: 1;
+ transition: opacity 0.15s;
+}
+
+.month-year-view.hidden {
+ visibility: hidden;
+ opacity: 0;
+}
+
+.month-year-view > .spinner-container {
+ width: 5.5rem;
+ margin: 0 0.5rem;
+}
+
+.month-year-view .spinner {
+ transform: scaleY(1);
+ transform-origin: top;
+ transition: transform 0.15s;
+}
+
+.month-year-view.hidden .spinner {
+ transform: scaleY(0);
+ transition: none;
+}
+
+.month-year-view .spinner > div {
+ transform: scaleY(1);
+ transition: transform 0.15s;
+}
+
+.month-year-view.hidden .spinner > div {
+ transform: scaleY(2.5);
+ transition: none;
+}
+
+.calendar-container {
+ cursor: default;
+ display: flex;
+ flex-direction: column;
+ width: var(--calendar-width);
+}
+
+.week-header {
+ display: flex;
+}
+
+.week-header > div {
+ color: var(--weekday-header-font-color);
+}
+
+.week-header > div.weekend {
+ color: var(--weekend-header-font-color);
+}
+
+.days-viewport {
+ height: 15rem;
+ overflow: hidden;
+ position: relative;
+}
+
+.days-view {
+ position: absolute;
+ display: flex;
+ flex-wrap: wrap;
+ flex-direction: row;
+}
+
+.week-header > div,
+.days-view > div {
+ align-items: center;
+ display: flex;
+ height: var(--date-picker-item-height);
+ position: relative;
+ justify-content: center;
+ width: var(--date-picker-item-width);
+}
+
+.days-view > .outside {
+ color: var(--weekday-outside-font-color);
+}
+
+.days-view > .weekend {
+ color: var(--weekend-font-color);
+}
+
+.days-view > .weekend.outside {
+ color: var(--weekend-outside-font-color);
+}
+
+.days-view > .out-of-range,
+.days-view > .off-step {
+ color: var(--weekday-disabled-font-color);
+ background: var(--disabled-fill-color);
+}
+
+.days-view > .out-of-range.weekend,
+.days-view > .off-step.weekend {
+ color: var(--weekend-disabled-font-color);
+}
+
+.days-view > .today {
+ font-weight: bold;
+}
+
+.days-view > .out-of-range::before,
+.days-view > .off-step::before {
+ display: none;
+}
+
+.days-view > div:hover::before,
+.days-view > .select::before,
+.days-view > .today::before {
+ top: 5%;
+ bottom: 5%;
+ left: 5%;
+ right: 5%;
+}
+
+#time-picker,
+.month-year-view {
+ display: flex;
+ flex-direction: row;
+ justify-content: center;
+}
+
+.spinner-container {
+ display: flex;
+ flex-direction: column;
+ width: var(--spinner-width);
+}
+
+.spinner-container > button {
+ background-color: var(--button-font-color);
+ height: var(--spinner-button-height);
+}
+
+.spinner-container > button:hover {
+ background-color: var(--button-font-color-hover);
+}
+
+.spinner-container > button.active {
+ background-color: var(--button-font-color-active);
+}
+
+.spinner-container > button.up {
+ background: url("chrome://global/skin/icons/spinner-arrows.svg#up") no-repeat 50% 50%;
+}
+
+.spinner-container > button.down {
+ background: url("chrome://global/skin/icons/spinner-arrows.svg#down") no-repeat 50% 50%;
+}
+
+.spinner-container.hide-buttons > button {
+ visibility: hidden;
+}
+
+.spinner-container > .spinner {
+ position: relative;
+ width: 100%;
+ margin: var(--spinner-margin-top-bottom) 0;
+ cursor: default;
+ overflow-y: scroll;
+ scroll-snap-type: mandatory;
+ scroll-snap-points-y: repeat(100%);
+}
+
+.spinner-container > .spinner > div {
+ box-sizing: border-box;
+ position: relative;
+ text-align: center;
+ padding: calc((var(--spinner-item-height) - var(--font-size-default)) / 2) 0;
+ margin-bottom: var(--spinner-item-margin-bottom);
+ height: var(--spinner-item-height);
+ -moz-user-select: none;
+ scroll-snap-coordinate: 0 0;
+}
+
+.spinner-container > .spinner > div::before,
+.calendar-container .days-view > div::before {
+ position: absolute;
+ top: 5%;
+ bottom: 5%;
+ left: 5%;
+ right: 5%;
+ z-index: -10;
+ border-radius: var(--border-radius);
+}
+
+.spinner-container > .spinner > div:hover::before,
+.calendar-container .days-view > div:hover::before {
+ background: var(--fill-color);
+ border: var(--border);
+ content: "";
+}
+
+.calendar-container .days-view > div.today::before {
+ background: var(--today-fill-color);
+ content: "";
+}
+
+.spinner-container > .spinner:not(.scrolling) > div.selection,
+.calendar-container .days-view > div.selection {
+ color: var(--selected-font-color);
+}
+
+.spinner-container > .spinner > div.selection::before,
+.calendar-container .days-view > div.selection::before {
+ background: var(--selected-fill-color);
+ border: none;
+ content: "";
+}
+
+.spinner-container > .spinner > div.disabled::before,
+.spinner-container > .spinner.scrolling > div.selection::before,
+.spinner-container > .spinner.scrolling > div:hover::before {
+ display: none;
+}
+
+.spinner-container > .spinner > div.disabled {
+ opacity: var(--disabled-opacity);
+}
+
+.colon {
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ width: var(--colon-width);
+ margin-bottom: 0.3rem;
+}
+
+.spacer {
+ width: var(--day-period-spacing-width);
+} \ No newline at end of file
diff --git a/toolkit/themes/shared/datetimepopup.css b/toolkit/themes/shared/datetimepopup.css
new file mode 100644
index 000000000..52f6fc7a2
--- /dev/null
+++ b/toolkit/themes/shared/datetimepopup.css
@@ -0,0 +1,11 @@
+/* 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/. */
+
+@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
+
+panel[type="arrow"][side="top"],
+panel[type="arrow"][side="bottom"] {
+ margin-left: 0;
+ margin-right: 0;
+}
diff --git a/toolkit/themes/shared/icons/calendar-arrows.svg b/toolkit/themes/shared/icons/calendar-arrows.svg
new file mode 100644
index 000000000..858676f55
--- /dev/null
+++ b/toolkit/themes/shared/icons/calendar-arrows.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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/. -->
+<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 14 14">
+ <style>
+ path:not(:target) {
+ display: none;
+ }
+ </style>
+ <path id="right" d="M4.8 14L3 12.3 8.5 7 3 1.7 4.8 0 12 7"/>
+ <path id="left" d="M9.2 0L11 1.7 5.5 7 11 12.3 9.2 14 2 7"/>
+</svg>
diff --git a/toolkit/themes/shared/icons/spinner-arrows.svg b/toolkit/themes/shared/icons/spinner-arrows.svg
new file mode 100644
index 000000000..a8ba72d6b
--- /dev/null
+++ b/toolkit/themes/shared/icons/spinner-arrows.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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/. -->
+<svg xmlns="http://www.w3.org/2000/svg" width="10" height="6" viewBox="0 0 10 6">
+ <style>
+ path:not(:target) {
+ display: none;
+ }
+ </style>
+ <path id="down" d="M0 1l1-1 4 4 4-4 1 1-5 5"/>
+ <path id="up" d="M0 5l1 1 4-4 4 4 1-1-5-5"/>
+</svg>
diff --git a/toolkit/themes/shared/jar.inc.mn b/toolkit/themes/shared/jar.inc.mn
index 9c3d86a40..bdfca2a05 100644
--- a/toolkit/themes/shared/jar.inc.mn
+++ b/toolkit/themes/shared/jar.inc.mn
@@ -21,12 +21,15 @@ toolkit.jar:
skin/classic/global/aboutSupport.css (../../shared/aboutSupport.css)
skin/classic/global/appPicker.css (../../shared/appPicker.css)
skin/classic/global/config.css (../../shared/config.css)
- skin/classic/global/timepicker.css (../../shared/timepicker.css)
+ skin/classic/global/datetimeinputpickers.css (../../shared/datetimeinputpickers.css)
+ skin/classic/global/datetimepopup.css (../../shared/datetimepopup.css)
+ skin/classic/global/icons/calendar-arrows.svg (../../shared/icons/calendar-arrows.svg)
skin/classic/global/icons/find-arrows.svg (../../shared/icons/find-arrows.svg)
skin/classic/global/icons/info.svg (../../shared/incontent-icons/info.svg)
skin/classic/global/icons/input-clear.svg (../../shared/icons/input-clear.svg)
skin/classic/global/icons/loading.png (../../shared/icons/loading.png)
skin/classic/global/icons/loading@2x.png (../../shared/icons/loading@2x.png)
+ skin/classic/global/icons/spinner-arrows.svg (../../shared/icons/spinner-arrows.svg)
skin/classic/global/icons/warning.svg (../../shared/incontent-icons/warning.svg)
skin/classic/global/icons/blocked.svg (../../shared/incontent-icons/blocked.svg)
skin/classic/global/alerts/alert-common.css (../../shared/alert-common.css)
diff --git a/toolkit/themes/shared/non-mac.jar.inc.mn b/toolkit/themes/shared/non-mac.jar.inc.mn
index a783bbb3c..637537d9d 100644
--- a/toolkit/themes/shared/non-mac.jar.inc.mn
+++ b/toolkit/themes/shared/non-mac.jar.inc.mn
@@ -77,6 +77,8 @@
skin/classic/global/icons/Landscape.png (../../windows/global/icons/Landscape.png)
skin/classic/global/icons/Question.png (../../windows/global/icons/Question.png)
skin/classic/global/icons/question-16.png (../../windows/global/icons/question-16.png)
+ skin/classic/global/icons/question-32.png (../../windows/global/icons/question-32.png)
+ skin/classic/global/icons/question-48.png (../../windows/global/icons/question-48.png)
skin/classic/global/icons/question-64.png (../../windows/global/icons/question-64.png)
skin/classic/global/icons/resizer-rtl.png (../../windows/global/icons/resizer-rtl.png)
skin/classic/global/icons/Restore.gif (../../windows/global/icons/Restore.gif)
diff --git a/toolkit/themes/shared/timepicker.css b/toolkit/themes/shared/timepicker.css
deleted file mode 100644
index e8d081b30..000000000
--- a/toolkit/themes/shared/timepicker.css
+++ /dev/null
@@ -1,153 +0,0 @@
-/* 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/. */
-
-:root {
- --font-size-default: 1.1rem;
- --spinner-width: 3rem;
- --spinner-margin-top-bottom: 0.4rem;
- --spinner-item-height: 2.4rem;
- --spinner-item-margin-bottom: 0.1rem;
- --spinner-button-height: 1.2rem;
- --colon-width: 2rem;
- --day-period-spacing-width: 1rem;
-
- --border: 0.1rem solid #D6D6D6;
- --border-radius: 0.3rem;
-
- --font-color: #191919;
- --fill-color: #EBEBEB;
-
- --selected-font-color: #FFFFFF;
- --selected-fill-color: #0996F8;
-
- --button-font-color: #858585;
- --button-font-color-hover: #4D4D4D;
- --button-font-color-active: #191919;
-
- --disabled-opacity: 0.2;
-}
-
-html {
- font-size: 10px;
-}
-
-body {
- margin: 0;
- color: var(--font-color);
- font-size: var(--font-size-default);
-}
-
-#time-picker {
- display: flex;
- flex-direction: row;
- justify-content: space-around;
-}
-
-.spinner-container {
- font-family: sans-serif;
- display: flex;
- flex-direction: column;
- width: var(--spinner-width);
-}
-
-.spinner-container > button {
- -moz-appearance: none;
- border: none;
- background: none;
- background-color: var(--button-font-color);
- height: var(--spinner-button-height);
-}
-
-.spinner-container > button:hover {
- background-color: var(--button-font-color-hover);
-}
-
-.spinner-container > button.active {
- background-color: var(--button-font-color-active);
-}
-
-.spinner-container > button.up {
- mask: url("chrome://global/skin/icons/find-arrows.svg#glyph-find-previous") no-repeat 50% 50%;
-}
-
-.spinner-container > button.down {
- mask: url("chrome://global/skin/icons/find-arrows.svg#glyph-find-next") no-repeat 50% 50%;
-}
-
-.spinner-container.hide-buttons > button {
- visibility: hidden;
-}
-
-.spinner-container > .spinner {
- position: relative;
- width: 100%;
- margin: var(--spinner-margin-top-bottom) 0;
- cursor: default;
- overflow-y: scroll;
- scroll-snap-type: mandatory;
- scroll-snap-points-y: repeat(100%);
-}
-
-.spinner-container > .spinner > div {
- box-sizing: border-box;
- position: relative;
- text-align: center;
- padding: calc((var(--spinner-item-height) - var(--font-size-default)) / 2) 0;
- margin-bottom: var(--spinner-item-margin-bottom);
- height: var(--spinner-item-height);
- -moz-user-select: none;
- scroll-snap-coordinate: 0 0;
-}
-
-.spinner-container > .spinner > div:hover::before {
- background: var(--fill-color);
- border: var(--border);
- border-radius: var(--border-radius);
- content: "";
- position: absolute;
- top: 0%;
- bottom: 0%;
- left: 0%;
- right: 0%;
- z-index: -10;
-}
-
-.spinner-container > .spinner:not(.scrolling) > div.selection {
- color: var(--selected-font-color);
-}
-
-.spinner-container > .spinner > div.selection::before {
- background: var(--selected-fill-color);
- border: none;
- border-radius: var(--border-radius);
- content: "";
- position: absolute;
- top: 0%;
- bottom: 0%;
- left: 0%;
- right: 0%;
- z-index: -10;
-}
-
-.spinner-container > .spinner > div.disabled::before,
-.spinner-container > .spinner.scrolling > div.selection::before,
-.spinner-container > .spinner.scrolling > div:hover::before {
- display: none;
-}
-
-.spinner-container > .spinner > div.disabled {
- opacity: var(--disabled-opacity);
-}
-
-.colon {
- display: flex;
- justify-content: center;
- align-items: center;
- width: var(--colon-width);
- margin-bottom: 0.3rem;
-}
-
-.spacer {
- width: var(--day-period-spacing-width);
-} \ No newline at end of file
diff --git a/toolkit/themes/windows/global/findBar.css b/toolkit/themes/windows/global/findBar.css
index 96115f193..34b3ae49b 100644
--- a/toolkit/themes/windows/global/findBar.css
+++ b/toolkit/themes/windows/global/findBar.css
@@ -4,8 +4,18 @@
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
+.findbar-closebutton {
+ border: none;
+ padding: 3px 5px;
+ -moz-appearance: none;
+}
+
+.findbar-closebutton:-moz-lwtheme-brighttext {
+ list-style-image: url("chrome://global/skin/icons/close-inverted.png");
+}
+
findbar {
- box-shadow: 0 1px 1px rgba(0,0,0,.1) inset;
+ padding-top: 1px;
background-image: linear-gradient(rgba(0,0,0,.15) 1px, rgba(255,255,255,.15) 1px);
background-size: 100% 2px;
background-repeat: no-repeat;
@@ -24,137 +34,94 @@ findbar[hidden] {
transition-delay: 0s, 0s, 150ms;
}
-findbar[noanim] {
- transition-duration: 0s !important;
- transition-delay: 0s !important;
-}
+/* find-next button */
-.findbar-container {
- padding-inline-start: 8px;
- padding-top: 4px;
- padding-bottom: 4px;
+.findbar-find-next {
+ list-style-image: url("chrome://global/skin/icons/find.png");
+ -moz-image-region: rect(0px 16px 16px 0px);
}
-.findbar-closebutton {
- margin-inline-start: 4px;
- padding-inline-start: 0;
- padding-inline-end: 8px;
- border: none;
- -moz-appearance: none;
+.findbar-find-next:hover {
+ -moz-image-region: rect(16px 16px 32px 0px);
}
-
-/* Search field */
-
-.findbar-textbox {
- -moz-appearance: none;
- border: 1px solid ThreeDShadow;
- border-radius: 2px 0 0 2px;
- margin: 0;
- padding: 1px 5px;
- width: 14em;
+.findbar-find-next[disabled="true"] {
+ -moz-image-region: rect(32px 16px 48px 0px) !important;
}
-.findbar-textbox:-moz-locale-dir(rtl) {
- border-radius: 0 2px 2px 0;
-}
+/* find-previous button */
-.findbar-textbox[focused="true"] {
- border-color: Highlight;
+.findbar-find-previous {
+ list-style-image: url("chrome://global/skin/icons/find.png");
+ -moz-image-region: rect(0px 32px 16px 16px);
}
-.findbar-textbox[status="notfound"] {
- background-color: #f66;
- color: white;
+.findbar-find-previous:hover {
+ -moz-image-region: rect(16px 32px 32px 16px);
}
-.findbar-textbox[flash="true"] {
- background-color: yellow;
- color: black;
+.findbar-find-previous[disabled="true"] {
+ -moz-image-region: rect(32px 32px 48px 16px) !important;
}
-.findbar-textbox.minimal {
- border-radius: 2px;
-}
-
-/* Buttons */
-
-.findbar-find-previous,
-.findbar-find-next {
- margin-inline-start: 0;
- -moz-appearance: none;
- background: linear-gradient(rgba(255,255,255,.8) 1px, rgba(255,255,255,.4) 1px, rgba(255,255,255,.1));
- border: 1px solid ThreeDShadow;
- padding: 1px 5px;
- line-height: 1em;
-}
+/* highlight button */
-.findbar-find-previous:not([disabled]):active,
-.findbar-find-next:not([disabled]):active {
- background: rgba(23,50,76,.2);
- box-shadow: 0 1px 2px rgba(10,31,51,.2) inset;
+.findbar-highlight {
+ list-style-image: url("chrome://global/skin/icons/find.png");
+ -moz-image-region: rect(0px 48px 16px 32px);
}
-.findbar-find-previous {
- list-style-image: url(chrome://global/skin/icons/find-arrows.svg#glyph-find-previous);
+.findbar-highlight:hover {
+ -moz-image-region: rect(16px 48px 32px 32px);
}
-.findbar-find-next {
- list-style-image: url(chrome://global/skin/icons/find-arrows.svg#glyph-find-next);
+.findbar-highlight[disabled="true"] {
+ -moz-image-region: rect(32px 48px 48px 32px) !important;
}
-.findbar-find-previous,
-.findbar-find-previous:not([disabled]):active {
- border-right: none;
- border-left: none;
+.findbar-highlight:active, .findbar-highlight[checked="true"] {
+ -moz-image-region: rect(48px 48px 64px 32px);
}
-.findbar-find-previous > .toolbarbutton-icon,
-.findbar-find-next > .toolbarbutton-icon {
- margin: 0;
+.findbar-highlight[checked="true"]:hover {
+ -moz-image-region: rect(64px 48px 80px 32px);
}
-.findbar-find-previous[disabled="true"] > .toolbarbutton-icon,
-.findbar-find-next[disabled="true"] > .toolbarbutton-icon {
- opacity: .5;
+.find-status-icon {
+ list-style-image: none;
+ margin-top: 2px;
+ margin-bottom: 0px;
+ -moz-margin-start: 12px;
+ -moz-margin-end: 0px;
+ width: 16px;
+ height: 16px;
}
-.findbar-find-next:-moz-locale-dir(ltr) {
- border-top-right-radius: 2px;
- border-bottom-right-radius: 2px;
+.findbar-find-status,
+.found-matches {
+ margin: 0 !important;
+ -moz-margin-start: 3px !important;
+ padding: 2px !important;
}
-.findbar-find-next:-moz-locale-dir(rtl) {
- border-top-left-radius: 2px;
- border-bottom-left-radius: 2px;
+.find-status-icon[status="notfound"] {
+ list-style-image: url("chrome://global/skin/icons/information-16.png");
}
-.findbar-highlight,
-.findbar-case-sensitive,
-.findbar-entire-word {
- margin-inline-start: 5px;
+.findbar-textbox[status="notfound"] {
+ box-shadow: 0 0 0 1em #f66 inset;
+ color: white;
}
-.findbar-highlight > .toolbarbutton-icon,
-.findbar-case-sensitive > .toolbarbutton-icon,
-.findbar-entire-word > .toolbarbutton-icon {
- display: none;
+.findbar-textbox[flash="true"] {
+ box-shadow: 0 0 0 1em yellow inset;
+ color: black;
}
-.findbar-find-status,
-.found-matches {
- color: GrayText;
- margin: 0 !important;
- margin-inline-start: 12px !important;
+.find-status-icon[status="wrapped"] {
+ list-style-image: url("chrome://global/skin/icons/wrap.png");
}
.find-status-icon[status="pending"] {
- list-style-image: url("chrome://global/skin/icons/loading.png");
-}
-
-@media (min-resolution: 1.1dppx) {
- .find-status-icon[status="pending"] {
- width: 16px;
- list-style-image: url("chrome://global/skin/icons/loading@2x.png");
- }
+ list-style-image: url("chrome://global/skin/icons/loading_16.png");
}
diff --git a/toolkit/themes/windows/global/icons/find.png b/toolkit/themes/windows/global/icons/find.png
new file mode 100644
index 000000000..60d6da97e
--- /dev/null
+++ b/toolkit/themes/windows/global/icons/find.png
Binary files differ
diff --git a/toolkit/themes/windows/global/icons/question-32.png b/toolkit/themes/windows/global/icons/question-32.png
new file mode 100644
index 000000000..7c80831b0
--- /dev/null
+++ b/toolkit/themes/windows/global/icons/question-32.png
Binary files differ
diff --git a/toolkit/themes/windows/global/icons/question-48.png b/toolkit/themes/windows/global/icons/question-48.png
new file mode 100644
index 000000000..dd2b21874
--- /dev/null
+++ b/toolkit/themes/windows/global/icons/question-48.png
Binary files differ
diff --git a/toolkit/themes/windows/global/inContentUI.css b/toolkit/themes/windows/global/inContentUI.css
new file mode 100644
index 000000000..a3bca7b06
--- /dev/null
+++ b/toolkit/themes/windows/global/inContentUI.css
@@ -0,0 +1,159 @@
+/* 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/. */
+
+/*
+ * The default namespace for this file is XUL. Be sure to prefix rules that
+ * are applicable to both XUL and HTML with '*|'.
+ */
+@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
+@namespace html url("http://www.w3.org/1999/xhtml");
+
+/* Page background */
+*|*:root {
+ -moz-appearance: none;
+ padding: 18px;
+ background-repeat: repeat;
+ color: -moz-dialogText;
+ background-color: -moz-dialog;
+ background-image: /* Texture */
+ url("chrome://global/skin/inContentUI/background-texture.png");
+}
+
+html|html {
+ font: message-box;
+}
+
+@media (-moz-windows-default-theme) and (-moz-os-version: windows-vista),
+ (-moz-windows-default-theme) and (-moz-os-version: windows-win7) {
+ *|*:root {
+ color: #000;
+ background-color: #CCD9EA;
+ }
+}
+
+@media (-moz-windows-glass) {
+ *|*:root {
+ /* Blame shorlander for this monstrosity. */
+ background-image: /* Side gradients */
+ linear-gradient(to right,
+ rgba(255,255,255,0.2), transparent 40%,
+ transparent 60%, rgba(255,255,255,0.2)),
+ /* Aero-style light beams */
+ -moz-linear-gradient(left 32deg,
+ /* First light beam */
+ transparent 19.5%, rgba(255,255,255,0.1) 20%,
+ rgba(255,255,255,0.1) 21.5%, rgba(255,255,255,0.2) 22%,
+ rgba(255,255,255,0.2) 25.5%, rgba(255,255,255,0.1) 26%,
+ rgba(255,255,255,0.1) 27.5%, transparent 28%,
+ /* Second light beam */
+ transparent 49.5%, rgba(255,255,255,0.1) 50%,
+ rgba(255,255,255,0.1) 52.5%, rgba(255,255,255,0.2) 53%,
+ rgba(255,255,255,0.2) 54.5%, rgba(255,255,255,0.1) 55%,
+ rgba(255,255,255,0.1) 57.5%, transparent 58%,
+ /* Third light beam */
+ transparent 87%, rgba(255,255,255,0.2) 90%),
+ /* Texture */
+ url("chrome://global/skin/inContentUI/background-texture.png");
+ }
+}
+
+/* Use the new in-content colors for #contentAreaDownloadsView. After landing
+ of bug 989469 the colors can be moved to *|*:root */
+*|*#contentAreaDownloadsView {
+ background: #f1f1f1;
+ color: #424e5a;
+}
+
+/* Content */
+*|*.main-content {
+ /* Needed to allow the radius to clip the inner content, see bug 595656 */
+ overflow: hidden;
+ background-color: rgba(255, 255, 255, 0.35);
+ background-image: linear-gradient(rgba(255, 255, 255, 0),
+ rgba(255, 255, 255, 0.75));
+ border: 1px solid #C3CEDF;
+}
+
+%ifdef XP_WIN
+@media (-moz-os-version: windows-vista),
+ (-moz-os-version: windows-win7) {
+%endif
+ *|*.main-content {
+ border-radius: 5px;
+ }
+%ifdef XP_WIN
+}
+%endif
+
+@media (-moz-windows-glass) {
+ /* Buttons */
+ *|button,
+ menulist,
+ colorpicker[type="button"] {
+ -moz-appearance: none;
+ color: black;
+ padding: 0 5px;
+ background: linear-gradient(rgba(251, 252, 253, 0.95), transparent 49%,
+ rgba(211, 212, 213, 0.45) 51%, rgba(225, 226, 229, 0.3));
+ background-clip: padding-box;
+ border-radius: 3px;
+ border: 1px solid rgba(31, 64, 100, 0.4);
+ border-top-color: rgba(31, 64, 100, 0.3);
+ box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.25) inset,
+ 0 0 2px 1px rgba(255, 255, 255, 0.25) inset;
+ }
+
+ menulist {
+ -moz-padding-end: 0;
+ }
+
+ colorpicker[type="button"]:-moz-focusring:not([open="true"]) > .colorpicker-button-colorbox {
+ outline: 1px dotted ThreeDDarkShadow;
+ }
+
+ html|button[disabled],
+ button[disabled="true"],
+ menulist[disabled="true"],
+ colorpicker[type="button"][disabled="true"] {
+ -moz-border-top-colors: rgba(31, 64, 100, 0.3) !important;
+ -moz-border-right-colors: rgba(31, 64, 100, 0.4) !important;
+ -moz-border-bottom-colors: rgba(31, 64, 100, 0.4) !important;
+ -moz-border-left-colors: rgba(31, 64, 100, 0.4) !important;
+ opacity: 0.8;
+ color: #505050;
+ }
+
+ html|button:not([disabled]):active:hover,
+ button:not([disabled="true"]):active:hover,
+ menulist[open="true"]:not([disabled="true"]),
+ colorpicker[type="button"][open="true"]:not([disabled="true"]) {
+ background-color: rgba(61, 76, 92, 0.2);
+ border-color: rgba(39, 53, 68, 0.5);
+ box-shadow: 0 0 3px 1px rgba(39, 53, 68, 0.2) inset;
+ }
+
+ button > .button-box {
+ padding: 1px !important;
+ }
+
+ spinbuttons > .spinbuttons-box > .spinbuttons-button {
+ border-radius: 0;
+ padding: 0 4px;
+ }
+
+ spinbuttons > .spinbuttons-box > .spinbuttons-up {
+ list-style-image: url("chrome://global/skin/arrow/arrow-up.gif");
+ border-bottom-width: 0;
+ }
+
+ spinbuttons > .spinbuttons-box > .spinbuttons-down {
+ list-style-image: url("chrome://global/skin/arrow/arrow-dn.gif");
+ }
+}
+
+colorpicker[type="button"] {
+ margin: 1px 5px 2px 5px;
+ padding: 3px;
+ height: 25px;
+}
diff --git a/toolkit/themes/windows/global/jar.mn b/toolkit/themes/windows/global/jar.mn
index 7f2f29942..8c5d5de5a 100644
--- a/toolkit/themes/windows/global/jar.mn
+++ b/toolkit/themes/windows/global/jar.mn
@@ -27,6 +27,7 @@ toolkit.jar:
skin/classic/global/console/itemSelected.png (console/itemSelected.png)
skin/classic/global/findBar.css
* skin/classic/global/global.css
+* skin/classic/global/inContentUI.css
skin/classic/global/listbox.css
skin/classic/global/netError.css
skin/classic/global/numberbox.css
@@ -48,6 +49,7 @@ toolkit.jar:
skin/classic/global/icons/close-win7@2x.png (icons/close-win7@2x.png)
skin/classic/global/icons/close-inverted-win7.png (icons/close-inverted-win7.png)
skin/classic/global/icons/close-inverted-win7@2x.png (icons/close-inverted-win7@2x.png)
+ skin/classic/global/icons/find.png (icons/find.png)
skin/classic/global/icons/resizer.png (icons/resizer.png)
skin/classic/global/icons/sslWarning.png (icons/sslWarning.png)
* skin/classic/global/in-content/common.css (in-content/common.css)
diff --git a/toolkit/themes/windows/mozapps/jar.mn b/toolkit/themes/windows/mozapps/jar.mn
index 29203811f..0d77a4e79 100644
--- a/toolkit/themes/windows/mozapps/jar.mn
+++ b/toolkit/themes/windows/mozapps/jar.mn
@@ -68,9 +68,13 @@ toolkit.jar:
* skin/classic/mozapps/xpinstall/xpinstallConfirm.css (extensions/xpinstallConfirm.css)
skin/classic/mozapps/xpinstall/xpinstallItemGeneric.png (extensions/extensionGeneric.png)
#endif
+ skin/classic/mozapps/passwordmgr/key.png (passwordmgr/key.png)
+ skin/classic/mozapps/passwordmgr/key-16.png (passwordmgr/key-16.png)
+ skin/classic/mozapps/passwordmgr/key-64.png (passwordmgr/key-64.png)
skin/classic/mozapps/plugins/pluginGeneric.png (plugins/pluginGeneric.png)
skin/classic/mozapps/plugins/pluginBlocked.png (plugins/pluginBlocked.png)
skin/classic/mozapps/plugins/pluginGeneric-16.png (plugins/pluginGeneric-16.png)
+ skin/classic/mozapps/plugins/pluginGeneric-48.png (plugins/pluginGeneric-48.png)
skin/classic/mozapps/profile/profileicon.png (profile/profileicon.png)
skin/classic/mozapps/update/updates.css (update/updates.css)
skin/classic/mozapps/viewsource/viewsource.css (viewsource/viewsource.css)
diff --git a/toolkit/themes/windows/mozapps/passwordmgr/key-16.png b/toolkit/themes/windows/mozapps/passwordmgr/key-16.png
new file mode 100644
index 000000000..ac135b847
--- /dev/null
+++ b/toolkit/themes/windows/mozapps/passwordmgr/key-16.png
Binary files differ
diff --git a/toolkit/themes/windows/mozapps/passwordmgr/key-64.png b/toolkit/themes/windows/mozapps/passwordmgr/key-64.png
new file mode 100644
index 000000000..0fb69f382
--- /dev/null
+++ b/toolkit/themes/windows/mozapps/passwordmgr/key-64.png
Binary files differ
diff --git a/toolkit/themes/windows/mozapps/passwordmgr/key.png b/toolkit/themes/windows/mozapps/passwordmgr/key.png
new file mode 100644
index 000000000..b5e8afefc
--- /dev/null
+++ b/toolkit/themes/windows/mozapps/passwordmgr/key.png
Binary files differ
diff --git a/toolkit/themes/windows/mozapps/plugins/pluginGeneric-16.png b/toolkit/themes/windows/mozapps/plugins/pluginGeneric-16.png
index 5d796cc4c..080b0e502 100644
--- a/toolkit/themes/windows/mozapps/plugins/pluginGeneric-16.png
+++ b/toolkit/themes/windows/mozapps/plugins/pluginGeneric-16.png
Binary files differ
diff --git a/toolkit/themes/windows/mozapps/plugins/pluginGeneric-48.png b/toolkit/themes/windows/mozapps/plugins/pluginGeneric-48.png
new file mode 100644
index 000000000..173679448
--- /dev/null
+++ b/toolkit/themes/windows/mozapps/plugins/pluginGeneric-48.png
Binary files differ
diff --git a/toolkit/themes/windows/mozapps/plugins/pluginGeneric.png b/toolkit/themes/windows/mozapps/plugins/pluginGeneric.png
index d8b270ae5..1fcbf154e 100644
--- a/toolkit/themes/windows/mozapps/plugins/pluginGeneric.png
+++ b/toolkit/themes/windows/mozapps/plugins/pluginGeneric.png
Binary files differ
diff --git a/toolkit/toolkit.mozbuild b/toolkit/toolkit.mozbuild
index a782acd3a..3b3bf80ae 100644
--- a/toolkit/toolkit.mozbuild
+++ b/toolkit/toolkit.mozbuild
@@ -181,10 +181,6 @@ if CONFIG['ENABLE_TESTS']:
'/testing/web-platform',
]
- # The file id utility requires breakpad libraries.
- if CONFIG['MOZ_CRASHREPORTER']:
- DIRS += ['/testing/tools/fileid']
-
if CONFIG['MOZ_MEMORY']:
DIRS += ['/memory/gtest']
diff --git a/toolkit/xre/MozMeegoAppService.h b/toolkit/xre/MozMeegoAppService.h
deleted file mode 100644
index 063d03e02..000000000
--- a/toolkit/xre/MozMeegoAppService.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=2 et sw=2 tw=80: */
-/* 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/. */
-
-#ifndef MOZMEEGOAPPSERVICE_H
-#define MOZMEEGOAPPSERVICE_H
-
-#include <MApplicationService>
-
-/**
- * App service class, which prevents registration to d-bus
- * and allows multiple instances of application. This is
- * required for Mozillas remote service to work, because
- * it is initialized after MApplication.
- */
-class MozMeegoAppService: public MApplicationService
-{
- Q_OBJECT
-public:
- MozMeegoAppService(): MApplicationService(QString()) {}
-public Q_SLOTS:
- virtual QString registeredName() { return QString(); }
- virtual bool isRegistered() { return false; }
- virtual bool registerService() { return true; }
-};
-#endif // MOZMEEGOAPPSERVICE_H
diff --git a/toolkit/xre/ProfileReset.cpp b/toolkit/xre/ProfileReset.cpp
index aef2d7746..c9e2ef8d4 100644
--- a/toolkit/xre/ProfileReset.cpp
+++ b/toolkit/xre/ProfileReset.cpp
@@ -31,13 +31,19 @@ static const char kProfileProperties[] =
* Creates a new profile with a timestamp in the name to use for profile reset.
*/
nsresult
-CreateResetProfile(nsIToolkitProfileService* aProfileSvc, nsIToolkitProfile* *aNewProfile)
+CreateResetProfile(nsIToolkitProfileService* aProfileSvc, const nsACString& aOldProfileName, nsIToolkitProfile* *aNewProfile)
{
MOZ_ASSERT(aProfileSvc, "NULL profile service");
nsCOMPtr<nsIToolkitProfile> newProfile;
- // Make the new profile "default-" + the time in seconds since epoch for uniqueness.
- nsAutoCString newProfileName("default-");
+ // Make the new profile the old profile (or "default-") + the time in seconds since epoch for uniqueness.
+ nsAutoCString newProfileName;
+ if (!aOldProfileName.IsEmpty()) {
+ newProfileName.Assign(aOldProfileName);
+ newProfileName.Append("-");
+ } else {
+ newProfileName.Assign("default-");
+ }
newProfileName.Append(nsPrintfCString("%lld", PR_Now() / 1000));
nsresult rv = aProfileSvc->CreateProfile(nullptr, // choose a default dir for us
newProfileName,
diff --git a/toolkit/xre/ProfileReset.h b/toolkit/xre/ProfileReset.h
index 7b5efbc4e..a164fe075 100644
--- a/toolkit/xre/ProfileReset.h
+++ b/toolkit/xre/ProfileReset.h
@@ -11,6 +11,7 @@ static bool gProfileResetCleanupCompleted = false;
static const char kResetProgressURL[] = "chrome://global/content/resetProfileProgress.xul";
nsresult CreateResetProfile(nsIToolkitProfileService* aProfileSvc,
+ const nsACString& aOldProfileName,
nsIToolkitProfile* *aNewProfile);
nsresult ProfileResetCleanup(nsIToolkitProfile* aOldProfile);
diff --git a/toolkit/xre/nsAndroidStartup.cpp b/toolkit/xre/nsAndroidStartup.cpp
index a88c58e5d..47b9ec6e5 100644
--- a/toolkit/xre/nsAndroidStartup.cpp
+++ b/toolkit/xre/nsAndroidStartup.cpp
@@ -26,15 +26,6 @@ GeckoStart(JNIEnv* env, char* data, const nsXREAppData* appData)
{
mozilla::jni::SetGeckoThreadEnv(env);
-#ifdef MOZ_CRASHREPORTER
- const struct mapping_info *info = getLibraryMapping();
- while (info->name) {
- CrashReporter::AddLibraryMapping(info->name, info->base,
- info->len, info->offset);
- info++;
- }
-#endif
-
if (!data) {
LOG("Failed to get arguments for GeckoStart\n");
return;
diff --git a/toolkit/xre/nsAppRunner.cpp b/toolkit/xre/nsAppRunner.cpp
index 1b5c2ed75..3493cd837 100644
--- a/toolkit/xre/nsAppRunner.cpp
+++ b/toolkit/xre/nsAppRunner.cpp
@@ -190,17 +190,6 @@
#include "jprof.h"
#endif
-#ifdef MOZ_CRASHREPORTER
-#include "nsExceptionHandler.h"
-#include "nsICrashReporter.h"
-#define NS_CRASHREPORTER_CONTRACTID "@mozilla.org/toolkit/crash-reporter;1"
-#include "nsIPrefService.h"
-#include "nsIMemoryInfoDumper.h"
-#if defined(XP_LINUX) && !defined(ANDROID)
-#include "mozilla/widget/LSBUtils.h"
-#endif
-#endif
-
#include "base/command_line.h"
#include "GTestRunner.h"
@@ -646,10 +635,6 @@ class nsXULAppInfo : public nsIXULAppInfo,
#ifdef XP_WIN
public nsIWinAppHelper,
#endif
-#ifdef MOZ_CRASHREPORTER
- public nsICrashReporter,
- public nsIFinishDumpingCallback,
-#endif
public nsIXULRuntime
{
@@ -660,10 +645,6 @@ public:
NS_DECL_NSIXULAPPINFO
NS_DECL_NSIXULRUNTIME
NS_DECL_NSIOBSERVER
-#ifdef MOZ_CRASHREPORTER
- NS_DECL_NSICRASHREPORTER
- NS_DECL_NSIFINISHDUMPINGCALLBACK
-#endif
#ifdef XP_WIN
NS_DECL_NSIWINAPPHELPER
#endif
@@ -676,10 +657,6 @@ NS_INTERFACE_MAP_BEGIN(nsXULAppInfo)
#ifdef XP_WIN
NS_INTERFACE_MAP_ENTRY(nsIWinAppHelper)
#endif
-#ifdef MOZ_CRASHREPORTER
- NS_INTERFACE_MAP_ENTRY(nsICrashReporter)
- NS_INTERFACE_MAP_ENTRY(nsIFinishDumpingCallback)
-#endif
NS_INTERFACE_MAP_ENTRY(nsIPlatformInfo)
NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIXULAppInfo, gAppData ||
XRE_IsContentProcess())
@@ -1004,12 +981,7 @@ nsXULAppInfo::GetReplacedLockTime(PRTime *aReplacedLockTime)
NS_IMETHODIMP
nsXULAppInfo::GetLastRunCrashID(nsAString &aLastRunCrashID)
{
-#ifdef MOZ_CRASHREPORTER
- CrashReporter::GetLastRunCrashID(aLastRunCrashID);
- return NS_OK;
-#else
return NS_ERROR_NOT_IMPLEMENTED;
-#endif
}
NS_IMETHODIMP
@@ -1051,7 +1023,7 @@ nsXULAppInfo::GetDistributionID(nsACString& aResult)
NS_IMETHODIMP
nsXULAppInfo::GetIsOfficial(bool* aResult)
{
-#ifdef MOZILLA_OFFICIAL
+#ifdef MC_OFFICIAL
*aResult = true;
#else
*aResult = false;
@@ -1117,219 +1089,6 @@ nsXULAppInfo::GetUserCanElevate(bool *aUserCanElevate)
}
#endif
-#ifdef MOZ_CRASHREPORTER
-NS_IMETHODIMP
-nsXULAppInfo::GetEnabled(bool *aEnabled)
-{
- *aEnabled = CrashReporter::GetEnabled();
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsXULAppInfo::SetEnabled(bool aEnabled)
-{
- if (aEnabled) {
- if (CrashReporter::GetEnabled()) {
- // no point in erroring for double-enabling
- return NS_OK;
- }
-
- nsCOMPtr<nsIFile> greBinDir;
- NS_GetSpecialDirectory(NS_GRE_BIN_DIR, getter_AddRefs(greBinDir));
- if (!greBinDir) {
- return NS_ERROR_FAILURE;
- }
-
- nsCOMPtr<nsIFile> xreBinDirectory = do_QueryInterface(greBinDir);
- if (!xreBinDirectory) {
- return NS_ERROR_FAILURE;
- }
-
- return CrashReporter::SetExceptionHandler(xreBinDirectory, true);
- }
- else {
- if (!CrashReporter::GetEnabled()) {
- // no point in erroring for double-disabling
- return NS_OK;
- }
-
- return CrashReporter::UnsetExceptionHandler();
- }
-}
-
-NS_IMETHODIMP
-nsXULAppInfo::GetServerURL(nsIURL** aServerURL)
-{
- if (!CrashReporter::GetEnabled())
- return NS_ERROR_NOT_INITIALIZED;
-
- nsAutoCString data;
- if (!CrashReporter::GetServerURL(data)) {
- return NS_ERROR_FAILURE;
- }
- nsCOMPtr<nsIURI> uri;
- NS_NewURI(getter_AddRefs(uri), data);
- if (!uri)
- return NS_ERROR_FAILURE;
-
- nsCOMPtr<nsIURL> url;
- url = do_QueryInterface(uri);
- NS_ADDREF(*aServerURL = url);
-
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsXULAppInfo::SetServerURL(nsIURL* aServerURL)
-{
- bool schemeOk;
- // only allow https or http URLs
- nsresult rv = aServerURL->SchemeIs("https", &schemeOk);
- NS_ENSURE_SUCCESS(rv, rv);
- if (!schemeOk) {
- rv = aServerURL->SchemeIs("http", &schemeOk);
- NS_ENSURE_SUCCESS(rv, rv);
-
- if (!schemeOk)
- return NS_ERROR_INVALID_ARG;
- }
- nsAutoCString spec;
- rv = aServerURL->GetSpec(spec);
- NS_ENSURE_SUCCESS(rv, rv);
-
- return CrashReporter::SetServerURL(spec);
-}
-
-NS_IMETHODIMP
-nsXULAppInfo::GetMinidumpPath(nsIFile** aMinidumpPath)
-{
- if (!CrashReporter::GetEnabled())
- return NS_ERROR_NOT_INITIALIZED;
-
- nsAutoString path;
- if (!CrashReporter::GetMinidumpPath(path))
- return NS_ERROR_FAILURE;
-
- nsresult rv = NS_NewLocalFile(path, false, aMinidumpPath);
- NS_ENSURE_SUCCESS(rv, rv);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsXULAppInfo::SetMinidumpPath(nsIFile* aMinidumpPath)
-{
- nsAutoString path;
- nsresult rv = aMinidumpPath->GetPath(path);
- NS_ENSURE_SUCCESS(rv, rv);
- return CrashReporter::SetMinidumpPath(path);
-}
-
-NS_IMETHODIMP
-nsXULAppInfo::AnnotateCrashReport(const nsACString& key,
- const nsACString& data)
-{
- return CrashReporter::AnnotateCrashReport(key, data);
-}
-
-NS_IMETHODIMP
-nsXULAppInfo::AppendAppNotesToCrashReport(const nsACString& data)
-{
- return CrashReporter::AppendAppNotesToCrashReport(data);
-}
-
-NS_IMETHODIMP
-nsXULAppInfo::RegisterAppMemory(uint64_t pointer,
- uint64_t len)
-{
- return CrashReporter::RegisterAppMemory((void *)pointer, len);
-}
-
-NS_IMETHODIMP
-nsXULAppInfo::WriteMinidumpForException(void* aExceptionInfo)
-{
-#ifdef XP_WIN32
- return CrashReporter::WriteMinidumpForException(static_cast<EXCEPTION_POINTERS*>(aExceptionInfo));
-#else
- return NS_ERROR_NOT_IMPLEMENTED;
-#endif
-}
-
-NS_IMETHODIMP
-nsXULAppInfo::AppendObjCExceptionInfoToAppNotes(void* aException)
-{
-#ifdef XP_MACOSX
- return CrashReporter::AppendObjCExceptionInfoToAppNotes(aException);
-#else
- return NS_ERROR_NOT_IMPLEMENTED;
-#endif
-}
-
-NS_IMETHODIMP
-nsXULAppInfo::GetSubmitReports(bool* aEnabled)
-{
- return CrashReporter::GetSubmitReports(aEnabled);
-}
-
-NS_IMETHODIMP
-nsXULAppInfo::SetSubmitReports(bool aEnabled)
-{
- return CrashReporter::SetSubmitReports(aEnabled);
-}
-
-NS_IMETHODIMP
-nsXULAppInfo::UpdateCrashEventsDir()
-{
- CrashReporter::UpdateCrashEventsDir();
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsXULAppInfo::SaveMemoryReport()
-{
- if (!CrashReporter::GetEnabled()) {
- return NS_ERROR_NOT_INITIALIZED;
- }
- nsCOMPtr<nsIFile> file;
- nsresult rv = CrashReporter::GetDefaultMemoryReportFile(getter_AddRefs(file));
- if (NS_WARN_IF(NS_FAILED(rv))) {
- return rv;
- }
-
- nsString path;
- file->GetPath(path);
-
- nsCOMPtr<nsIMemoryInfoDumper> dumper =
- do_GetService("@mozilla.org/memory-info-dumper;1");
- if (NS_WARN_IF(!dumper)) {
- return NS_ERROR_UNEXPECTED;
- }
-
- rv = dumper->DumpMemoryReportsToNamedFile(path, this, file, true /* anonymize */);
- if (NS_WARN_IF(NS_FAILED(rv))) {
- return rv;
- }
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsXULAppInfo::SetTelemetrySessionId(const nsACString& id)
-{
- CrashReporter::SetTelemetrySessionId(id);
- return NS_OK;
-}
-
-// This method is from nsIFInishDumpingCallback.
-NS_IMETHODIMP
-nsXULAppInfo::Callback(nsISupports* aData)
-{
- nsCOMPtr<nsIFile> file = do_QueryInterface(aData);
- MOZ_ASSERT(file);
-
- CrashReporter::SetMemoryReportFile(file);
- return NS_OK;
-}
-#endif
-
static const nsXULAppInfo kAppInfo;
static nsresult AppInfoConstructor(nsISupports* aOuter,
REFNSIID aIID, void **aResult)
@@ -1434,9 +1193,6 @@ static const mozilla::Module::CIDEntry kXRECIDs[] = {
static const mozilla::Module::ContractIDEntry kXREContracts[] = {
{ XULAPPINFO_SERVICE_CONTRACTID, &kAPPINFO_CID },
{ XULRUNTIME_SERVICE_CONTRACTID, &kAPPINFO_CID },
-#ifdef MOZ_CRASHREPORTER
- { NS_CRASHREPORTER_CONTRACTID, &kAPPINFO_CID },
-#endif
{ NS_PROFILESERVICE_CONTRACTID, &kProfileServiceCID },
{ NS_NATIVEAPPSUPPORT_CONTRACTID, &kNativeAppSupportCID },
{ nullptr }
@@ -1601,7 +1357,9 @@ DumpHelp()
" -v or --version Print %s version.\n"
" -P <profile> Start with <profile>.\n"
" --profile <path> Start with profile at <path>.\n"
+#ifdef MC_BASILISK
" --migration Start with migration wizard.\n"
+#endif
" --ProfileManager Start with ProfileManager.\n"
" --no-remote Do not accept or send remote commands;\n"
" implies --new-instance.\n"
@@ -2130,17 +1888,20 @@ ShowProfileManager(nsIToolkitProfileService* aProfileSvc,
}
/**
- * Set the currently running profile as the default/selected one.
+ * Get the currently running profile using its root directory.
*
+ * @param aProfileSvc The profile service
* @param aCurrentProfileRoot The root directory of the current profile.
- * @return an error if aCurrentProfileRoot is not found or the profile could not
- * be set as the default.
+ * @param aProfile Out-param that returns the profile object.
+ * @return an error if aCurrentProfileRoot is not found
*/
static nsresult
-SetCurrentProfileAsDefault(nsIToolkitProfileService* aProfileSvc,
- nsIFile* aCurrentProfileRoot)
+GetCurrentProfile(nsIToolkitProfileService* aProfileSvc,
+ nsIFile* aCurrentProfileRoot,
+ nsIToolkitProfile** aProfile)
{
NS_ENSURE_ARG_POINTER(aProfileSvc);
+ NS_ENSURE_ARG_POINTER(aProfile);
nsCOMPtr<nsISimpleEnumerator> profiles;
nsresult rv = aProfileSvc->GetProfiles(getter_AddRefs(profiles));
@@ -2156,7 +1917,8 @@ SetCurrentProfileAsDefault(nsIToolkitProfileService* aProfileSvc,
profile->GetRootDir(getter_AddRefs(profileRoot));
profileRoot->Equals(aCurrentProfileRoot, &foundMatchingProfile);
if (foundMatchingProfile) {
- return aProfileSvc->SetSelectedProfile(profile);
+ profile.forget(aProfile);
+ return NS_OK;
}
rv = profiles->GetNext(getter_AddRefs(supports));
}
@@ -2244,7 +2006,7 @@ SelectProfile(nsIProfileLock* *aResult, nsIToolkitProfileService* aProfileSvc, n
if (gDoProfileReset) {
// If we're resetting a profile, create a new one and use it to startup.
nsCOMPtr<nsIToolkitProfile> newProfile;
- rv = CreateResetProfile(aProfileSvc, getter_AddRefs(newProfile));
+ rv = CreateResetProfile(aProfileSvc, gResetOldProfileName, getter_AddRefs(newProfile));
if (NS_SUCCEEDED(rv)) {
rv = newProfile->GetRootDir(getter_AddRefs(lf));
NS_ENSURE_SUCCESS(rv, rv);
@@ -2390,20 +2152,20 @@ SelectProfile(nsIProfileLock* *aResult, nsIToolkitProfileService* aProfileSvc, n
return ProfileLockedDialog(profile, unlocker, aNative, &tempProfileLock);
}
- nsCOMPtr<nsIToolkitProfile> newProfile;
- rv = CreateResetProfile(aProfileSvc, getter_AddRefs(newProfile));
- if (NS_FAILED(rv)) {
- NS_WARNING("Failed to create a profile to reset to.");
- gDoProfileReset = false;
- } else {
- nsresult gotName = profile->GetName(gResetOldProfileName);
- if (NS_SUCCEEDED(gotName)) {
- profile = newProfile;
- } else {
- NS_WARNING("Failed to get the name of the profile we're resetting, so aborting reset.");
- gResetOldProfileName.Truncate(0);
+ nsresult gotName = profile->GetName(gResetOldProfileName);
+ if (NS_SUCCEEDED(gotName)) {
+ nsCOMPtr<nsIToolkitProfile> newProfile;
+ rv = CreateResetProfile(aProfileSvc, gResetOldProfileName, getter_AddRefs(newProfile));
+ if (NS_FAILED(rv)) {
+ NS_WARNING("Failed to create a profile to reset to.");
gDoProfileReset = false;
+ } else {
+ profile = newProfile;
}
+ } else {
+ NS_WARNING("Failed to get the name of the profile we're resetting, so aborting reset.");
+ gResetOldProfileName.Truncate(0);
+ gDoProfileReset = false;
}
}
@@ -2498,20 +2260,22 @@ SelectProfile(nsIProfileLock* *aResult, nsIToolkitProfileService* aProfileSvc, n
return ProfileLockedDialog(profile, unlocker, aNative, &tempProfileLock);
}
- nsCOMPtr<nsIToolkitProfile> newProfile;
- rv = CreateResetProfile(aProfileSvc, getter_AddRefs(newProfile));
- if (NS_FAILED(rv)) {
- NS_WARNING("Failed to create a profile to reset to.");
- gDoProfileReset = false;
- } else {
- nsresult gotName = profile->GetName(gResetOldProfileName);
- if (NS_SUCCEEDED(gotName)) {
- profile = newProfile;
- } else {
- NS_WARNING("Failed to get the name of the profile we're resetting, so aborting reset.");
- gResetOldProfileName.Truncate(0);
+ nsresult gotName = profile->GetName(gResetOldProfileName);
+ if (NS_SUCCEEDED(gotName)) {
+ nsCOMPtr<nsIToolkitProfile> newProfile;
+ rv = CreateResetProfile(aProfileSvc, gResetOldProfileName, getter_AddRefs(newProfile));
+ if (NS_FAILED(rv)) {
+ NS_WARNING("Failed to create a profile to reset to.");
gDoProfileReset = false;
}
+ else {
+ profile = newProfile;
+ }
+ }
+ else {
+ NS_WARNING("Failed to get the name of the profile we're resetting, so aborting reset.");
+ gResetOldProfileName.Truncate(0);
+ gDoProfileReset = false;
}
}
@@ -2763,33 +2527,6 @@ static void RestoreStateForAppInitiatedRestart()
}
}
-#ifdef MOZ_CRASHREPORTER
-// When we first initialize the crash reporter we don't have a profile,
-// so we set the minidump path to $TEMP. Once we have a profile,
-// we set it to $PROFILE/minidumps, creating the directory
-// if needed.
-static void MakeOrSetMinidumpPath(nsIFile* profD)
-{
- nsCOMPtr<nsIFile> dumpD;
- profD->Clone(getter_AddRefs(dumpD));
-
- if (dumpD) {
- bool fileExists;
- //XXX: do some more error checking here
- dumpD->Append(NS_LITERAL_STRING("minidumps"));
- dumpD->Exists(&fileExists);
- if (!fileExists) {
- nsresult rv = dumpD->Create(nsIFile::DIRECTORY_TYPE, 0700);
- NS_ENSURE_SUCCESS_VOID(rv);
- }
-
- nsAutoString pathStr;
- if (NS_SUCCEEDED(dumpD->GetPath(pathStr)))
- CrashReporter::SetMinidumpPath(pathStr);
- }
-}
-#endif
-
const nsXREAppData* gAppData = nullptr;
#ifdef MOZ_WIDGET_GTK
@@ -3215,94 +2952,6 @@ XREMain::XRE_mainInit(bool* aExitFlag)
if (NS_FAILED(rv))
return 1;
-#ifdef MOZ_CRASHREPORTER
- if (EnvHasValue("MOZ_CRASHREPORTER")) {
- mAppData->flags |= NS_XRE_ENABLE_CRASH_REPORTER;
- }
-
- nsCOMPtr<nsIFile> xreBinDirectory;
- xreBinDirectory = mDirProvider.GetGREBinDir();
-
- if ((mAppData->flags & NS_XRE_ENABLE_CRASH_REPORTER) &&
- NS_SUCCEEDED(
- CrashReporter::SetExceptionHandler(xreBinDirectory))) {
- nsCOMPtr<nsIFile> file;
- rv = mDirProvider.GetUserAppDataDirectory(getter_AddRefs(file));
- if (NS_SUCCEEDED(rv)) {
- CrashReporter::SetUserAppDataDirectory(file);
- }
- if (mAppData->crashReporterURL)
- CrashReporter::SetServerURL(nsDependentCString(mAppData->crashReporterURL));
-
- // We overwrite this once we finish starting up.
- CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("StartupCrash"),
- NS_LITERAL_CSTRING("1"));
-
- // pass some basic info from the app data
- if (mAppData->vendor)
- CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("Vendor"),
- nsDependentCString(mAppData->vendor));
- if (mAppData->name)
- CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("ProductName"),
- nsDependentCString(mAppData->name));
- if (mAppData->ID)
- CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("ProductID"),
- nsDependentCString(mAppData->ID));
- if (mAppData->version)
- CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("Version"),
- nsDependentCString(mAppData->version));
- if (mAppData->buildID)
- CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("BuildID"),
- nsDependentCString(mAppData->buildID));
-
- nsDependentCString releaseChannel(NS_STRINGIFY(MOZ_UPDATE_CHANNEL));
- CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("ReleaseChannel"),
- releaseChannel);
-#ifdef MOZ_LINKER
- CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("CrashAddressLikelyWrong"),
- IsSignalHandlingBroken() ? NS_LITERAL_CSTRING("1")
- : NS_LITERAL_CSTRING("0"));
-#endif
-
-#ifdef XP_WIN
- nsAutoString appInitDLLs;
- if (widget::WinUtils::GetAppInitDLLs(appInitDLLs)) {
- CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("AppInitDLLs"),
- NS_ConvertUTF16toUTF8(appInitDLLs));
- }
-#endif
-
- CrashReporter::SetRestartArgs(gArgc, gArgv);
-
- // annotate other data (user id etc)
- nsCOMPtr<nsIFile> userAppDataDir;
- if (NS_SUCCEEDED(mDirProvider.GetUserAppDataDirectory(
- getter_AddRefs(userAppDataDir)))) {
- CrashReporter::SetupExtraData(userAppDataDir,
- nsDependentCString(mAppData->buildID));
-
- // see if we have a crashreporter-override.ini in the application directory
- nsCOMPtr<nsIFile> overrideini;
- bool exists;
- if (NS_SUCCEEDED(mDirProvider.GetAppDir()->Clone(getter_AddRefs(overrideini))) &&
- NS_SUCCEEDED(overrideini->AppendNative(NS_LITERAL_CSTRING("crashreporter-override.ini"))) &&
- NS_SUCCEEDED(overrideini->Exists(&exists)) &&
- exists) {
-#ifdef XP_WIN
- nsAutoString overridePathW;
- overrideini->GetPath(overridePathW);
- NS_ConvertUTF16toUTF8 overridePath(overridePathW);
-#else
- nsAutoCString overridePath;
- overrideini->GetNativePath(overridePath);
-#endif
-
- SaveWordToEnv("MOZ_CRASHREPORTER_STRINGS_OVERRIDE", overridePath);
- }
- }
- }
-#endif
-
#if defined(MOZ_SANDBOX) && defined(XP_WIN)
if (mAppData->sandboxBrokerServices) {
SandboxBroker::Initialize(mAppData->sandboxBrokerServices);
@@ -3448,22 +3097,9 @@ XREMain::XRE_mainInit(bool* aExitFlag)
}
}
-#ifdef MOZ_CRASHREPORTER
- if (cpuUpdateRevision > 0) {
- CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("CPUMicrocodeVersion"),
- nsPrintfCString("0x%x",
- cpuUpdateRevision));
- }
-#endif
}
#endif
-#ifdef MOZ_CRASHREPORTER
- CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("SafeMode"),
- gSafeMode ? NS_LITERAL_CSTRING("1") :
- NS_LITERAL_CSTRING("0"));
-#endif
-
// Handle --no-remote and --new-instance command line arguments. Setup
// the environment to better accommodate other components and various
// restart scenarios.
@@ -3523,102 +3159,6 @@ XREMain::XRE_mainInit(bool* aExitFlag)
return 0;
}
-#ifdef MOZ_CRASHREPORTER
-#ifdef XP_WIN
-/**
- * Uses WMI to read some manufacturer information that may be useful for
- * diagnosing hardware-specific crashes. This function is best-effort; failures
- * shouldn't burden the caller. COM must be initialized before calling.
- */
-static void AnnotateSystemManufacturer()
-{
- RefPtr<IWbemLocator> locator;
-
- HRESULT hr = CoCreateInstance(CLSID_WbemLocator, nullptr, CLSCTX_INPROC_SERVER,
- IID_IWbemLocator, getter_AddRefs(locator));
-
- if (FAILED(hr)) {
- return;
- }
-
- RefPtr<IWbemServices> services;
-
- hr = locator->ConnectServer(_bstr_t(L"ROOT\\CIMV2"), nullptr, nullptr, nullptr,
- 0, nullptr, nullptr, getter_AddRefs(services));
-
- if (FAILED(hr)) {
- return;
- }
-
- hr = CoSetProxyBlanket(services, RPC_C_AUTHN_WINNT, RPC_C_AUTHZ_NONE, nullptr,
- RPC_C_AUTHN_LEVEL_CALL, RPC_C_IMP_LEVEL_IMPERSONATE,
- nullptr, EOAC_NONE);
-
- if (FAILED(hr)) {
- return;
- }
-
- RefPtr<IEnumWbemClassObject> enumerator;
-
- hr = services->ExecQuery(_bstr_t(L"WQL"), _bstr_t(L"SELECT * FROM Win32_BIOS"),
- WBEM_FLAG_FORWARD_ONLY | WBEM_FLAG_RETURN_IMMEDIATELY,
- nullptr, getter_AddRefs(enumerator));
-
- if (FAILED(hr) || !enumerator) {
- return;
- }
-
- RefPtr<IWbemClassObject> classObject;
- ULONG results;
-
- hr = enumerator->Next(WBEM_INFINITE, 1, getter_AddRefs(classObject), &results);
-
- if (FAILED(hr) || results == 0) {
- return;
- }
-
- VARIANT value;
- VariantInit(&value);
-
- hr = classObject->Get(L"Manufacturer", 0, &value, 0, 0);
-
- if (SUCCEEDED(hr) && V_VT(&value) == VT_BSTR) {
- CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("BIOS_Manufacturer"),
- NS_ConvertUTF16toUTF8(V_BSTR(&value)));
- }
-
- VariantClear(&value);
-}
-
-static void PR_CALLBACK AnnotateSystemManufacturer_ThreadStart(void*)
-{
- HRESULT hr = CoInitialize(nullptr);
-
- if (FAILED(hr)) {
- return;
- }
-
- AnnotateSystemManufacturer();
-
- CoUninitialize();
-}
-#endif // XP_WIN
-
-#if defined(XP_LINUX) && !defined(ANDROID)
-
-static void
-AnnotateLSBRelease(void*)
-{
- nsCString dist, desc, release, codename;
- if (widget::lsb::GetLSBRelease(dist, desc, release, codename)) {
- CrashReporter::AppendAppNotesToCrashReport(desc);
- }
-}
-
-#endif // defined(XP_LINUX) && !defined(ANDROID)
-
-#endif
-
namespace mozilla {
ShutdownChecksMode gShutdownChecks = SCM_NOTHING;
} // namespace mozilla
@@ -4007,13 +3547,6 @@ XREMain::XRE_mainStartup(bool* aExitFlag)
mozilla::Telemetry::SetProfileDir(mProfD);
-#ifdef MOZ_CRASHREPORTER
- if (mAppData->flags & NS_XRE_ENABLE_CRASH_REPORTER)
- MakeOrSetMinidumpPath(mProfD);
-
- CrashReporter::SetProfileDirectory(mProfD);
-#endif
-
nsAutoCString version;
BuildVersion(version);
@@ -4103,39 +3636,6 @@ XREMain::XRE_mainStartup(bool* aExitFlag)
return 0;
}
-#if defined(MOZ_CRASHREPORTER)
-#if defined(MOZ_CONTENT_SANDBOX) && !defined(MOZ_WIDGET_GONK)
-void AddSandboxAnnotations()
-{
- // Include the sandbox content level, regardless of platform
- int level = Preferences::GetInt("security.sandbox.content.level");
-
- nsAutoCString levelString;
- levelString.AppendInt(level);
-
- CrashReporter::AnnotateCrashReport(
- NS_LITERAL_CSTRING("ContentSandboxLevel"), levelString);
-
- // Include whether or not this instance is capable of content sandboxing
- bool sandboxCapable = false;
-
-#if defined(XP_WIN)
- // All supported Windows versions support some level of content sandboxing
- sandboxCapable = true;
-#elif defined(XP_MACOSX)
- // All supported OS X versions are capable
- sandboxCapable = true;
-#elif defined(XP_LINUX)
- sandboxCapable = SandboxInfo::Get().CanSandboxContent();
-#endif
-
- CrashReporter::AnnotateCrashReport(
- NS_LITERAL_CSTRING("ContentSandboxCapable"),
- sandboxCapable ? NS_LITERAL_CSTRING("1") : NS_LITERAL_CSTRING("0"));
-}
-#endif /* MOZ_CONTENT_SANDBOX && !MOZ_WIDGET_GONK */
-#endif /* MOZ_CRASHREPORTER */
-
/*
* XRE_mainRun - Command line startup, profile migration, and
* the calling of appStartup->Run().
@@ -4169,40 +3669,6 @@ XREMain::XRE_mainRun()
rv = mScopedXPCOM->SetWindowCreator(mNativeApp);
NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
-#ifdef MOZ_CRASHREPORTER
- // tell the crash reporter to also send the release channel
- nsCOMPtr<nsIPrefService> prefs = do_GetService("@mozilla.org/preferences-service;1", &rv);
- if (NS_SUCCEEDED(rv)) {
- nsCOMPtr<nsIPrefBranch> defaultPrefBranch;
- rv = prefs->GetDefaultBranch(nullptr, getter_AddRefs(defaultPrefBranch));
-
- if (NS_SUCCEEDED(rv)) {
- nsXPIDLCString sval;
- rv = defaultPrefBranch->GetCharPref("app.update.channel", getter_Copies(sval));
- if (NS_SUCCEEDED(rv)) {
- CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("ReleaseChannel"),
- sval);
- }
- }
- }
- // Needs to be set after xpcom initialization.
- CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("FramePoisonBase"),
- nsPrintfCString("%.16llx", uint64_t(gMozillaPoisonBase)));
- CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("FramePoisonSize"),
- nsPrintfCString("%lu", uint32_t(gMozillaPoisonSize)));
-
-#ifdef XP_WIN
- PR_CreateThread(PR_USER_THREAD, AnnotateSystemManufacturer_ThreadStart, 0,
- PR_PRIORITY_LOW, PR_GLOBAL_THREAD, PR_UNJOINABLE_THREAD, 0);
-#endif
-
-#if defined(XP_LINUX) && !defined(ANDROID)
- PR_CreateThread(PR_USER_THREAD, AnnotateLSBRelease, 0, PR_PRIORITY_LOW,
- PR_GLOBAL_THREAD, PR_UNJOINABLE_THREAD, 0);
-#endif
-
-#endif
-
if (mStartOffline) {
nsCOMPtr<nsIIOService2> io (do_GetService("@mozilla.org/network/io-service;1"));
NS_ENSURE_TRUE(io, NS_ERROR_FAILURE);
@@ -4281,7 +3747,12 @@ XREMain::XRE_mainRun()
if (gDoProfileReset) {
// Automatically migrate from the current application if we just
// reset the profile.
- aKey = MOZ_APP_NAME;
+ // For Basilisk and Pale Moon:
+ // Hard-code MOZ_APP_NAME to firefox because of hard-coded type in migrator.
+ aKey = (((MOZ_APP_NAME == "basilisk")
+ || (MOZ_APP_NAME == "palemoon"))
+ ? "firefox" : MOZ_APP_NAME);
+
}
pm->Migrate(&mDirProvider, aKey, gResetOldProfileName);
}
@@ -4291,15 +3762,23 @@ XREMain::XRE_mainRun()
nsresult backupCreated = ProfileResetCleanup(profileBeingReset);
if (NS_FAILED(backupCreated)) NS_WARNING("Could not cleanup the profile that was reset");
- // Set the new profile as the default after we're done cleaning up the old profile,
- // iff that profile was already the default
- if (profileWasSelected) {
- // this is actually "broken" - see bug 1122124
- rv = SetCurrentProfileAsDefault(mProfileSvc, mProfD);
- if (NS_FAILED(rv)) NS_WARNING("Could not set current profile as the default");
+ nsCOMPtr<nsIToolkitProfile> newProfile;
+ rv = GetCurrentProfile(mProfileSvc, mProfD, getter_AddRefs(newProfile));
+ if (NS_SUCCEEDED(rv)) {
+ newProfile->SetName(gResetOldProfileName);
+ mProfileName.Assign(gResetOldProfileName);
+ // Set the new profile as the default after we're done cleaning up the old profile,
+ // iff that profile was already the default
+ if (profileWasSelected) {
+ rv = mProfileSvc->SetDefaultProfile(newProfile);
+ if (NS_FAILED(rv)) NS_WARNING("Could not set current profile as the default");
+ }
+ } else {
+ NS_WARNING("Could not find current profile to set as default / change name.");
}
- // Need to write out the fact that the profile has been removed and potentially
- // that the selected/default profile changed.
+
+ // Need to write out the fact that the profile has been removed, the new profile
+ // renamed, and potentially that the selected/default profile changed.
mProfileSvc->Flush();
}
}
@@ -4308,17 +3787,6 @@ XREMain::XRE_mainRun()
OverrideDefaultLocaleIfNeeded();
-#ifdef MOZ_CRASHREPORTER
- nsCString userAgentLocale;
- // Try a localized string first. This pref is always a localized string in
- // Fennec, and might be elsewhere, too.
- if (NS_SUCCEEDED(Preferences::GetLocalizedCString("general.useragent.locale", &userAgentLocale))) {
- CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("useragent_locale"), userAgentLocale);
- } else if (NS_SUCCEEDED(Preferences::GetCString("general.useragent.locale", &userAgentLocale))) {
- CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("useragent_locale"), userAgentLocale);
- }
-#endif
-
appStartup->GetShuttingDown(&mShuttingDown);
nsCOMPtr<nsICommandLineRunner> cmdLine;
@@ -4411,11 +3879,6 @@ XREMain::XRE_mainRun()
(void)appStartup->DoneStartingUp();
-#ifdef MOZ_CRASHREPORTER
- CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("StartupCrash"),
- NS_LITERAL_CSTRING("0"));
-#endif
-
appStartup->GetShuttingDown(&mShuttingDown);
}
@@ -4466,21 +3929,8 @@ XREMain::XRE_mainRun()
sandboxInfo.Test(SandboxInfo::kEnabledForContent));
Telemetry::Accumulate(Telemetry::SANDBOX_MEDIA_ENABLED,
sandboxInfo.Test(SandboxInfo::kEnabledForMedia));
-#if defined(MOZ_CRASHREPORTER)
- nsAutoCString flagsString;
- flagsString.AppendInt(sandboxInfo.AsInteger());
-
- CrashReporter::AnnotateCrashReport(
- NS_LITERAL_CSTRING("ContentSandboxCapabilities"), flagsString);
-#endif /* MOZ_CRASHREPORTER */
#endif /* MOZ_SANDBOX && XP_LINUX && !MOZ_WIDGET_GONK */
-#if defined(MOZ_CRASHREPORTER)
-#if defined(MOZ_CONTENT_SANDBOX) && !defined(MOZ_WIDGET_GONK)
- AddSandboxAnnotations();
-#endif /* MOZ_CONTENT_SANDBOX && !MOZ_WIDGET_GONK */
-#endif /* MOZ_CRASHREPORTER */
-
{
rv = appStartup->Run();
if (NS_FAILED(rv)) {
@@ -4673,10 +4123,6 @@ XREMain::XRE_main(int argc, char* argv[], const nsXREAppData* aAppData)
rv = LaunchChild(mNativeApp, true);
}
-#ifdef MOZ_CRASHREPORTER
- if (mAppData->flags & NS_XRE_ENABLE_CRASH_REPORTER)
- CrashReporter::UnsetExceptionHandler();
-#endif
return rv == NS_ERROR_LAUNCHED_CHILD_PROCESS ? 0 : 1;
}
@@ -4686,11 +4132,6 @@ XREMain::XRE_main(int argc, char* argv[], const nsXREAppData* aAppData)
MOZ_gdk_display_close(mGdkDisplay);
#endif
-#ifdef MOZ_CRASHREPORTER
- if (mAppData->flags & NS_XRE_ENABLE_CRASH_REPORTER)
- CrashReporter::UnsetExceptionHandler();
-#endif
-
XRE_DeinitCommandLine();
return NS_FAILED(rv) ? 1 : 0;
@@ -4863,15 +4304,8 @@ MultiprocessBlockPolicy() {
bool addonsCanDisable = Preferences::GetBool("extensions.e10sBlocksEnabling", false);
bool disabledByAddons = Preferences::GetBool("extensions.e10sBlockedByAddons", false);
-#ifdef MOZ_CRASHREPORTER
- CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("AddonsShouldHaveBlockedE10s"),
- disabledByAddons ? NS_LITERAL_CSTRING("1")
- : NS_LITERAL_CSTRING("0"));
-#endif
-
if (addonsCanDisable && disabledByAddons) {
gMultiprocessBlockPolicy = kE10sDisabledForAddons;
- return gMultiprocessBlockPolicy;
}
#if defined(XP_WIN)
@@ -4905,16 +4339,13 @@ MultiprocessBlockPolicy() {
if (disabledForA11y) {
gMultiprocessBlockPolicy = kE10sDisabledForAccessibility;
- return gMultiprocessBlockPolicy;
}
#endif
+
+ // We do not support E10S, block by policy.
+ gMultiprocessBlockPolicy = kE10sForceDisabled;
- /*
- * None of the blocking policies matched, so e10s is allowed to run.
- * Cache the information and return 0, indicating success.
- */
- gMultiprocessBlockPolicy = 0;
- return 0;
+ return gMultiprocessBlockPolicy;
}
bool
diff --git a/toolkit/xre/nsEmbedFunctions.cpp b/toolkit/xre/nsEmbedFunctions.cpp
index 1e67ea7ce..4a612e495 100644
--- a/toolkit/xre/nsEmbedFunctions.cpp
+++ b/toolkit/xre/nsEmbedFunctions.cpp
@@ -239,30 +239,6 @@ XRE_SetProcessType(const char* aProcessTypeString)
}
}
-#if defined(MOZ_CRASHREPORTER)
-// FIXME/bug 539522: this out-of-place function is stuck here because
-// IPDL wants access to this crashreporter interface, and
-// crashreporter is built in such a way to make that awkward
-bool
-XRE_TakeMinidumpForChild(uint32_t aChildPid, nsIFile** aDump,
- uint32_t* aSequence)
-{
- return CrashReporter::TakeMinidumpForChild(aChildPid, aDump, aSequence);
-}
-
-bool
-XRE_SetRemoteExceptionHandler(const char* aPipe/*= 0*/)
-{
-#if defined(XP_WIN) || defined(XP_MACOSX)
- return CrashReporter::SetRemoteExceptionHandler(nsDependentCString(aPipe));
-#elif defined(OS_LINUX)
- return CrashReporter::SetRemoteExceptionHandler();
-#else
-# error "OOP crash reporter unsupported on this platform"
-#endif
-}
-#endif // if defined(MOZ_CRASHREPORTER)
-
#if defined(XP_WIN)
void
SetTaskbarGroupId(const nsString& aId)
@@ -273,22 +249,6 @@ SetTaskbarGroupId(const nsString& aId)
}
#endif
-#if defined(MOZ_CRASHREPORTER)
-#if defined(MOZ_CONTENT_SANDBOX) && !defined(MOZ_WIDGET_GONK)
-void
-AddContentSandboxLevelAnnotation()
-{
- if (XRE_GetProcessType() == GeckoProcessType_Content) {
- int level = Preferences::GetInt("security.sandbox.content.level");
- nsAutoCString levelString;
- levelString.AppendInt(level);
- CrashReporter::AnnotateCrashReport(
- NS_LITERAL_CSTRING("ContentSandboxLevel"), levelString);
- }
-}
-#endif /* MOZ_CONTENT_SANDBOX && !MOZ_WIDGET_GONK */
-#endif /* MOZ_CRASHREPORTER */
-
nsresult
XRE_InitChildProcess(int aArgc,
char* aArgv[],
@@ -442,33 +402,6 @@ XRE_InitChildProcess(int aArgc,
SetupErrorHandling(aArgv[0]);
-#if defined(MOZ_CRASHREPORTER)
- if (aArgc < 1)
- return NS_ERROR_FAILURE;
- const char* const crashReporterArg = aArgv[--aArgc];
-
-# if defined(XP_WIN) || defined(XP_MACOSX)
- // on windows and mac, |crashReporterArg| is the named pipe on which the
- // server is listening for requests, or "-" if crash reporting is
- // disabled.
- if (0 != strcmp("-", crashReporterArg) &&
- !XRE_SetRemoteExceptionHandler(crashReporterArg)) {
- // Bug 684322 will add better visibility into this condition
- NS_WARNING("Could not setup crash reporting\n");
- }
-# elif defined(OS_LINUX)
- // on POSIX, |crashReporterArg| is "true" if crash reporting is
- // enabled, false otherwise
- if (0 != strcmp("false", crashReporterArg) &&
- !XRE_SetRemoteExceptionHandler(nullptr)) {
- // Bug 684322 will add better visibility into this condition
- NS_WARNING("Could not setup crash reporting\n");
- }
-# else
-# error "OOP crash reporting unsupported on this platform"
-# endif
-#endif // if defined(MOZ_CRASHREPORTER)
-
gArgv = aArgv;
gArgc = aArgc;
@@ -647,12 +580,6 @@ XRE_InitChildProcess(int aArgc,
return NS_ERROR_FAILURE;
}
-#ifdef MOZ_CRASHREPORTER
-#if defined(XP_WIN) || defined(XP_MACOSX)
- CrashReporter::InitChildProcessTmpDir();
-#endif
-#endif
-
#if defined(XP_WIN)
// Set child processes up such that they will get killed after the
// chrome process is killed in cases where the user shuts the system
@@ -668,12 +595,6 @@ XRE_InitChildProcess(int aArgc,
OverrideDefaultLocaleIfNeeded();
-#if defined(MOZ_CRASHREPORTER)
-#if defined(MOZ_CONTENT_SANDBOX) && !defined(MOZ_WIDGET_GONK)
- AddContentSandboxLevelAnnotation();
-#endif
-#endif
-
// Run the UI event loop on the main thread.
uiMessageLoop.MessageLoop::Run();
diff --git a/toolkit/xre/nsWindowsWMain.cpp b/toolkit/xre/nsWindowsWMain.cpp
index 788d25a90..e282374cc 100644
--- a/toolkit/xre/nsWindowsWMain.cpp
+++ b/toolkit/xre/nsWindowsWMain.cpp
@@ -18,10 +18,6 @@
#include "nsSetDllDirectory.h"
#endif
-#if defined(__GNUC__)
-#define XRE_DONT_SUPPORT_XPSP2
-#endif
-
#ifdef __MINGW32__
/* MingW currently does not implement a wide version of the
diff --git a/toolkit/xre/nsX11ErrorHandler.cpp b/toolkit/xre/nsX11ErrorHandler.cpp
index 0db24e58b..0fb0d29c5 100644
--- a/toolkit/xre/nsX11ErrorHandler.cpp
+++ b/toolkit/xre/nsX11ErrorHandler.cpp
@@ -117,18 +117,6 @@ X11Error(Display *display, XErrorEvent *event) {
}
}
-#ifdef MOZ_CRASHREPORTER
- switch (XRE_GetProcessType()) {
- case GeckoProcessType_Default:
- case GeckoProcessType_Plugin:
- case GeckoProcessType_Content:
- CrashReporter::AppendAppNotesToCrashReport(notes);
- break;
- default:
- ; // crash report notes not supported.
- }
-#endif
-
#ifdef DEBUG
// The resource id is unlikely to be useful in a crash report without
// context of other ids, but add it to the debug console output.