summaryrefslogtreecommitdiffstats
path: root/toolkit/components
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit/components')
-rw-r--r--toolkit/components/aboutcache/content/aboutCache.js4
-rw-r--r--toolkit/components/alerts/nsAlertsService.cpp23
-rw-r--r--toolkit/components/alerts/nsAlertsService.h17
-rw-r--r--toolkit/components/alerts/resources/content/alert.css1
-rw-r--r--toolkit/components/alerts/resources/content/alert.js38
-rw-r--r--toolkit/components/alerts/resources/content/alert.xul1
-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/build/nsToolkitCompsModule.cpp12
-rw-r--r--toolkit/components/console/jsconsole-clhandler.js2
-rw-r--r--toolkit/components/cookie/moz.build3
-rw-r--r--toolkit/components/ctypes/tests/jsctypes-test-finalizer.cpp4
-rw-r--r--toolkit/components/extensions/test/mochitest/test_ext_sendmessage_reply2.html93
-rw-r--r--toolkit/components/feeds/FeedProcessor.js3
-rw-r--r--toolkit/components/filepicker/nsFileView.cpp7
-rw-r--r--toolkit/components/jsdownloads/src/DownloadIntegration.jsm71
-rw-r--r--toolkit/components/maintenanceservice/bootstrapinstaller/maintenanceservice_installer.nsi5
-rw-r--r--toolkit/components/maintenanceservice/maintenanceservice.exe.manifest1
-rw-r--r--toolkit/components/moz.build9
-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/moz.build4
-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/BookmarkHTMLUtils.jsm10
-rw-r--r--toolkit/components/places/PlacesUtils.jsm9
-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/search/moz.build7
-rw-r--r--toolkit/components/search/nsSearchService.js14
-rw-r--r--toolkit/components/telemetry/Histograms.json64
-rw-r--r--toolkit/components/telemetry/TelemetryEnvironment.jsm32
-rw-r--r--toolkit/components/telemetry/histogram-whitelists.json4
-rw-r--r--toolkit/components/telemetry/tests/unit/xpcshell.ini2
-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/.eslintrc.js (renamed from toolkit/components/extensions/.eslintrc.js)0
-rw-r--r--toolkit/components/webextensions/Extension.jsm (renamed from toolkit/components/extensions/Extension.jsm)0
-rw-r--r--toolkit/components/webextensions/ExtensionAPI.jsm (renamed from toolkit/components/extensions/ExtensionAPI.jsm)0
-rw-r--r--toolkit/components/webextensions/ExtensionChild.jsm (renamed from toolkit/components/extensions/ExtensionChild.jsm)28
-rw-r--r--toolkit/components/webextensions/ExtensionCommon.jsm (renamed from toolkit/components/extensions/ExtensionCommon.jsm)3
-rw-r--r--toolkit/components/webextensions/ExtensionContent.jsm (renamed from toolkit/components/extensions/ExtensionContent.jsm)4
-rw-r--r--toolkit/components/webextensions/ExtensionManagement.jsm (renamed from toolkit/components/extensions/ExtensionManagement.jsm)0
-rw-r--r--toolkit/components/webextensions/ExtensionParent.jsm (renamed from toolkit/components/extensions/ExtensionParent.jsm)0
-rw-r--r--toolkit/components/webextensions/ExtensionStorage.jsm (renamed from toolkit/components/extensions/ExtensionStorage.jsm)0
-rw-r--r--toolkit/components/webextensions/ExtensionTestCommon.jsm (renamed from toolkit/components/extensions/ExtensionTestCommon.jsm)0
-rw-r--r--toolkit/components/webextensions/ExtensionUtils.jsm (renamed from toolkit/components/extensions/ExtensionUtils.jsm)0
-rw-r--r--toolkit/components/webextensions/ExtensionXPCShellUtils.jsm (renamed from toolkit/components/extensions/ExtensionXPCShellUtils.jsm)0
-rw-r--r--toolkit/components/webextensions/LegacyExtensionsUtils.jsm (renamed from toolkit/components/extensions/LegacyExtensionsUtils.jsm)2
-rw-r--r--toolkit/components/webextensions/MessageChannel.jsm (renamed from toolkit/components/extensions/MessageChannel.jsm)0
-rw-r--r--toolkit/components/webextensions/NativeMessaging.jsm (renamed from toolkit/components/extensions/NativeMessaging.jsm)0
-rw-r--r--toolkit/components/webextensions/Schemas.jsm (renamed from toolkit/components/extensions/Schemas.jsm)0
-rw-r--r--toolkit/components/webextensions/ext-alarms.js (renamed from toolkit/components/extensions/ext-alarms.js)0
-rw-r--r--toolkit/components/webextensions/ext-backgroundPage.js (renamed from toolkit/components/extensions/ext-backgroundPage.js)0
-rw-r--r--toolkit/components/webextensions/ext-browser-content.js (renamed from toolkit/components/extensions/ext-browser-content.js)0
-rw-r--r--toolkit/components/webextensions/ext-c-backgroundPage.js (renamed from toolkit/components/extensions/ext-c-backgroundPage.js)4
-rw-r--r--toolkit/components/webextensions/ext-c-extension.js (renamed from toolkit/components/extensions/ext-c-extension.js)0
-rw-r--r--toolkit/components/webextensions/ext-c-runtime.js (renamed from toolkit/components/extensions/ext-c-runtime.js)5
-rw-r--r--toolkit/components/webextensions/ext-c-storage.js (renamed from toolkit/components/extensions/ext-c-storage.js)0
-rw-r--r--toolkit/components/webextensions/ext-c-test.js (renamed from toolkit/components/extensions/ext-c-test.js)0
-rw-r--r--toolkit/components/webextensions/ext-cookies.js (renamed from toolkit/components/extensions/ext-cookies.js)0
-rw-r--r--toolkit/components/webextensions/ext-downloads.js (renamed from toolkit/components/extensions/ext-downloads.js)0
-rw-r--r--toolkit/components/webextensions/ext-extension.js (renamed from toolkit/components/extensions/ext-extension.js)0
-rw-r--r--toolkit/components/webextensions/ext-i18n.js (renamed from toolkit/components/extensions/ext-i18n.js)0
-rw-r--r--toolkit/components/webextensions/ext-idle.js (renamed from toolkit/components/extensions/ext-idle.js)0
-rw-r--r--toolkit/components/webextensions/ext-management.js (renamed from toolkit/components/extensions/ext-management.js)0
-rw-r--r--toolkit/components/webextensions/ext-notifications.js (renamed from toolkit/components/extensions/ext-notifications.js)0
-rw-r--r--toolkit/components/webextensions/ext-runtime.js (renamed from toolkit/components/extensions/ext-runtime.js)0
-rw-r--r--toolkit/components/webextensions/ext-storage.js (renamed from toolkit/components/extensions/ext-storage.js)0
-rw-r--r--toolkit/components/webextensions/ext-topSites.js (renamed from toolkit/components/extensions/ext-topSites.js)0
-rw-r--r--toolkit/components/webextensions/ext-webNavigation.js (renamed from toolkit/components/extensions/ext-webNavigation.js)0
-rw-r--r--toolkit/components/webextensions/ext-webRequest.js (renamed from toolkit/components/extensions/ext-webRequest.js)0
-rw-r--r--toolkit/components/webextensions/extensions-toolkit.manifest (renamed from toolkit/components/extensions/extensions-toolkit.manifest)0
-rw-r--r--toolkit/components/webextensions/jar.mn (renamed from toolkit/components/extensions/jar.mn)0
-rw-r--r--toolkit/components/webextensions/moz.build (renamed from toolkit/components/extensions/moz.build)0
-rw-r--r--toolkit/components/webextensions/schemas/LICENSE (renamed from toolkit/components/extensions/schemas/LICENSE)0
-rw-r--r--toolkit/components/webextensions/schemas/alarms.json (renamed from toolkit/components/extensions/schemas/alarms.json)0
-rw-r--r--toolkit/components/webextensions/schemas/cookies.json (renamed from toolkit/components/extensions/schemas/cookies.json)0
-rw-r--r--toolkit/components/webextensions/schemas/downloads.json (renamed from toolkit/components/extensions/schemas/downloads.json)0
-rw-r--r--toolkit/components/webextensions/schemas/events.json (renamed from toolkit/components/extensions/schemas/events.json)0
-rw-r--r--toolkit/components/webextensions/schemas/experiments.json (renamed from toolkit/components/extensions/schemas/experiments.json)0
-rw-r--r--toolkit/components/webextensions/schemas/extension.json (renamed from toolkit/components/extensions/schemas/extension.json)0
-rw-r--r--toolkit/components/webextensions/schemas/extension_types.json (renamed from toolkit/components/extensions/schemas/extension_types.json)0
-rw-r--r--toolkit/components/webextensions/schemas/i18n.json (renamed from toolkit/components/extensions/schemas/i18n.json)0
-rw-r--r--toolkit/components/webextensions/schemas/idle.json (renamed from toolkit/components/extensions/schemas/idle.json)0
-rw-r--r--toolkit/components/webextensions/schemas/jar.mn (renamed from toolkit/components/extensions/schemas/jar.mn)0
-rw-r--r--toolkit/components/webextensions/schemas/management.json (renamed from toolkit/components/extensions/schemas/management.json)0
-rw-r--r--toolkit/components/webextensions/schemas/manifest.json (renamed from toolkit/components/extensions/schemas/manifest.json)0
-rw-r--r--toolkit/components/webextensions/schemas/moz.build (renamed from toolkit/components/extensions/schemas/moz.build)0
-rw-r--r--toolkit/components/webextensions/schemas/native_host_manifest.json (renamed from toolkit/components/extensions/schemas/native_host_manifest.json)0
-rw-r--r--toolkit/components/webextensions/schemas/notifications.json (renamed from toolkit/components/extensions/schemas/notifications.json)0
-rw-r--r--toolkit/components/webextensions/schemas/runtime.json (renamed from toolkit/components/extensions/schemas/runtime.json)2
-rw-r--r--toolkit/components/webextensions/schemas/storage.json (renamed from toolkit/components/extensions/schemas/storage.json)0
-rw-r--r--toolkit/components/webextensions/schemas/test.json (renamed from toolkit/components/extensions/schemas/test.json)0
-rw-r--r--toolkit/components/webextensions/schemas/top_sites.json (renamed from toolkit/components/extensions/schemas/top_sites.json)0
-rw-r--r--toolkit/components/webextensions/schemas/web_navigation.json (renamed from toolkit/components/extensions/schemas/web_navigation.json)0
-rw-r--r--toolkit/components/webextensions/schemas/web_request.json (renamed from toolkit/components/extensions/schemas/web_request.json)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/.eslintrc.js (renamed from toolkit/components/extensions/test/mochitest/.eslintrc.js)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/chrome.ini (renamed from toolkit/components/extensions/test/mochitest/chrome.ini)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/chrome_head.js (renamed from toolkit/components/extensions/test/mochitest/chrome_head.js)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/file_WebNavigation_page1.html (renamed from toolkit/components/extensions/test/mochitest/file_WebNavigation_page1.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/file_WebNavigation_page2.html (renamed from toolkit/components/extensions/test/mochitest/file_WebNavigation_page2.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/file_WebNavigation_page3.html (renamed from toolkit/components/extensions/test/mochitest/file_WebNavigation_page3.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/file_WebRequest_page3.html (renamed from toolkit/components/extensions/test/mochitest/file_WebRequest_page3.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/file_csp.html (renamed from toolkit/components/extensions/test/mochitest/file_csp.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/file_csp.html^headers^ (renamed from toolkit/components/extensions/test/mochitest/file_csp.html^headers^)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/file_ext_test_api_injection.js (renamed from toolkit/components/extensions/test/mochitest/file_ext_test_api_injection.js)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/file_image_bad.png (renamed from toolkit/components/extensions/test/mochitest/file_image_bad.png)bin5401 -> 5401 bytes
-rw-r--r--toolkit/components/webextensions/test/mochitest/file_image_good.png (renamed from toolkit/components/extensions/test/mochitest/file_image_good.png)bin580 -> 580 bytes
-rw-r--r--toolkit/components/webextensions/test/mochitest/file_image_redirect.png (renamed from toolkit/components/extensions/test/mochitest/file_image_redirect.png)bin5401 -> 5401 bytes
-rw-r--r--toolkit/components/webextensions/test/mochitest/file_mixed.html (renamed from toolkit/components/extensions/test/mochitest/file_mixed.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/file_permission_xhr.html (renamed from toolkit/components/extensions/test/mochitest/file_permission_xhr.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/file_privilege_escalation.html (renamed from toolkit/components/extensions/test/mochitest/file_privilege_escalation.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/file_sample.html (renamed from toolkit/components/extensions/test/mochitest/file_sample.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/file_script_bad.js (renamed from toolkit/components/extensions/test/mochitest/file_script_bad.js)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/file_script_good.js (renamed from toolkit/components/extensions/test/mochitest/file_script_good.js)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/file_script_redirect.js (renamed from toolkit/components/extensions/test/mochitest/file_script_redirect.js)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/file_script_xhr.js (renamed from toolkit/components/extensions/test/mochitest/file_script_xhr.js)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/file_style_bad.css (renamed from toolkit/components/extensions/test/mochitest/file_style_bad.css)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/file_style_good.css (renamed from toolkit/components/extensions/test/mochitest/file_style_good.css)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/file_style_redirect.css (renamed from toolkit/components/extensions/test/mochitest/file_style_redirect.css)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/file_teardown_test.js (renamed from toolkit/components/extensions/test/mochitest/file_teardown_test.js)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/file_webNavigation_clientRedirect.html (renamed from toolkit/components/extensions/test/mochitest/file_webNavigation_clientRedirect.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/file_webNavigation_clientRedirect_httpHeaders.html (renamed from toolkit/components/extensions/test/mochitest/file_webNavigation_clientRedirect_httpHeaders.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/file_webNavigation_clientRedirect_httpHeaders.html^headers^ (renamed from toolkit/components/extensions/test/mochitest/file_webNavigation_clientRedirect_httpHeaders.html^headers^)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/file_webNavigation_frameClientRedirect.html (renamed from toolkit/components/extensions/test/mochitest/file_webNavigation_frameClientRedirect.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/file_webNavigation_frameRedirect.html (renamed from toolkit/components/extensions/test/mochitest/file_webNavigation_frameRedirect.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/file_webNavigation_manualSubframe.html (renamed from toolkit/components/extensions/test/mochitest/file_webNavigation_manualSubframe.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/file_webNavigation_manualSubframe_page1.html (renamed from toolkit/components/extensions/test/mochitest/file_webNavigation_manualSubframe_page1.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/file_webNavigation_manualSubframe_page2.html (renamed from toolkit/components/extensions/test/mochitest/file_webNavigation_manualSubframe_page2.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/file_with_about_blank.html (renamed from toolkit/components/extensions/test/mochitest/file_with_about_blank.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/head.js (renamed from toolkit/components/extensions/test/mochitest/head.js)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/head_cookies.js (renamed from toolkit/components/extensions/test/mochitest/head_cookies.js)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/head_webrequest.js (renamed from toolkit/components/extensions/test/mochitest/head_webrequest.js)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/mochitest.ini (renamed from toolkit/components/extensions/test/mochitest/mochitest.ini)1
-rw-r--r--toolkit/components/webextensions/test/mochitest/redirection.sjs (renamed from toolkit/components/extensions/test/mochitest/redirection.sjs)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/return_headers.sjs (renamed from toolkit/components/extensions/test/mochitest/return_headers.sjs)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/test_chrome_ext_background_debug_global.html (renamed from toolkit/components/extensions/test/mochitest/test_chrome_ext_background_debug_global.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/test_chrome_ext_background_page.html (renamed from toolkit/components/extensions/test/mochitest/test_chrome_ext_background_page.html)6
-rw-r--r--toolkit/components/webextensions/test/mochitest/test_chrome_ext_contentscript_unrecognizedprop_warning.html (renamed from toolkit/components/extensions/test/mochitest/test_chrome_ext_contentscript_unrecognizedprop_warning.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/test_chrome_ext_downloads_saveAs.html (renamed from toolkit/components/extensions/test/mochitest/test_chrome_ext_downloads_saveAs.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/test_chrome_ext_eventpage_warning.html (renamed from toolkit/components/extensions/test/mochitest/test_chrome_ext_eventpage_warning.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/test_chrome_ext_hybrid_addons.html (renamed from toolkit/components/extensions/test/mochitest/test_chrome_ext_hybrid_addons.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/test_chrome_ext_idle.html (renamed from toolkit/components/extensions/test/mochitest/test_chrome_ext_idle.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/test_chrome_ext_shutdown_cleanup.html (renamed from toolkit/components/extensions/test/mochitest/test_chrome_ext_shutdown_cleanup.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/test_chrome_ext_storage_cleanup.html (renamed from toolkit/components/extensions/test/mochitest/test_chrome_ext_storage_cleanup.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/test_chrome_ext_trustworthy_origin.html (renamed from toolkit/components/extensions/test/mochitest/test_chrome_ext_trustworthy_origin.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/test_chrome_ext_webnavigation_resolved_urls.html (renamed from toolkit/components/extensions/test/mochitest/test_chrome_ext_webnavigation_resolved_urls.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/test_chrome_ext_webrequest_background_events.html (renamed from toolkit/components/extensions/test/mochitest/test_chrome_ext_webrequest_background_events.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/test_chrome_native_messaging_paths.html (renamed from toolkit/components/extensions/test/mochitest/test_chrome_native_messaging_paths.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/test_clipboard.html (renamed from toolkit/components/extensions/test/mochitest/test_clipboard.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/test_ext_all_apis.js (renamed from toolkit/components/extensions/test/mochitest/test_ext_all_apis.js)2
-rw-r--r--toolkit/components/webextensions/test/mochitest/test_ext_background_api_injection.html (renamed from toolkit/components/extensions/test/mochitest/test_ext_background_api_injection.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/test_ext_background_canvas.html (renamed from toolkit/components/extensions/test/mochitest/test_ext_background_canvas.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/test_ext_background_generated_url.html (renamed from toolkit/components/extensions/test/mochitest/test_ext_background_generated_url.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/test_ext_background_teardown.html (renamed from toolkit/components/extensions/test/mochitest/test_ext_background_teardown.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/test_ext_content_security_policy.html (renamed from toolkit/components/extensions/test/mochitest/test_ext_content_security_policy.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/test_ext_contentscript.html (renamed from toolkit/components/extensions/test/mochitest/test_ext_contentscript.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/test_ext_contentscript_about_blank.html (renamed from toolkit/components/extensions/test/mochitest/test_ext_contentscript_about_blank.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/test_ext_contentscript_api_injection.html (renamed from toolkit/components/extensions/test/mochitest/test_ext_contentscript_api_injection.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/test_ext_contentscript_async_loading.html (renamed from toolkit/components/extensions/test/mochitest/test_ext_contentscript_async_loading.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/test_ext_contentscript_context.html (renamed from toolkit/components/extensions/test/mochitest/test_ext_contentscript_context.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/test_ext_contentscript_create_iframe.html (renamed from toolkit/components/extensions/test/mochitest/test_ext_contentscript_create_iframe.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/test_ext_contentscript_css.html (renamed from toolkit/components/extensions/test/mochitest/test_ext_contentscript_css.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/test_ext_contentscript_devtools_metadata.html (renamed from toolkit/components/extensions/test/mochitest/test_ext_contentscript_devtools_metadata.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/test_ext_contentscript_exporthelpers.html (renamed from toolkit/components/extensions/test/mochitest/test_ext_contentscript_exporthelpers.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/test_ext_contentscript_incognito.html (renamed from toolkit/components/extensions/test/mochitest/test_ext_contentscript_incognito.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/test_ext_contentscript_permission.html (renamed from toolkit/components/extensions/test/mochitest/test_ext_contentscript_permission.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/test_ext_contentscript_teardown.html (renamed from toolkit/components/extensions/test/mochitest/test_ext_contentscript_teardown.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/test_ext_cookies.html (renamed from toolkit/components/extensions/test/mochitest/test_ext_cookies.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/test_ext_cookies_containers.html (renamed from toolkit/components/extensions/test/mochitest/test_ext_cookies_containers.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/test_ext_cookies_expiry.html (renamed from toolkit/components/extensions/test/mochitest/test_ext_cookies_expiry.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/test_ext_cookies_permissions_bad.html (renamed from toolkit/components/extensions/test/mochitest/test_ext_cookies_permissions_bad.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/test_ext_cookies_permissions_good.html (renamed from toolkit/components/extensions/test/mochitest/test_ext_cookies_permissions_good.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/test_ext_exclude_include_globs.html (renamed from toolkit/components/extensions/test/mochitest/test_ext_exclude_include_globs.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/test_ext_external_messaging.html111
-rw-r--r--toolkit/components/webextensions/test/mochitest/test_ext_generate.html (renamed from toolkit/components/extensions/test/mochitest/test_ext_generate.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/test_ext_geturl.html (renamed from toolkit/components/extensions/test/mochitest/test_ext_geturl.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/test_ext_i18n.html (renamed from toolkit/components/extensions/test/mochitest/test_ext_i18n.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/test_ext_i18n_css.html (renamed from toolkit/components/extensions/test/mochitest/test_ext_i18n_css.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/test_ext_inIncognitoContext_window.html (renamed from toolkit/components/extensions/test/mochitest/test_ext_inIncognitoContext_window.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/test_ext_jsversion.html (renamed from toolkit/components/extensions/test/mochitest/test_ext_jsversion.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/test_ext_listener_proxies.html (renamed from toolkit/components/extensions/test/mochitest/test_ext_listener_proxies.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/test_ext_notifications.html (renamed from toolkit/components/extensions/test/mochitest/test_ext_notifications.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/test_ext_permission_xhr.html (renamed from toolkit/components/extensions/test/mochitest/test_ext_permission_xhr.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/test_ext_runtime_connect.html (renamed from toolkit/components/extensions/test/mochitest/test_ext_runtime_connect.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/test_ext_runtime_connect2.html (renamed from toolkit/components/extensions/test/mochitest/test_ext_runtime_connect2.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/test_ext_runtime_connect_twoway.html (renamed from toolkit/components/extensions/test/mochitest/test_ext_runtime_connect_twoway.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/test_ext_runtime_disconnect.html (renamed from toolkit/components/extensions/test/mochitest/test_ext_runtime_disconnect.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/test_ext_runtime_id.html (renamed from toolkit/components/extensions/test/mochitest/test_ext_runtime_id.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/test_ext_sandbox_var.html (renamed from toolkit/components/extensions/test/mochitest/test_ext_sandbox_var.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/test_ext_schema.html (renamed from toolkit/components/extensions/test/mochitest/test_ext_schema.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/test_ext_sendmessage_doublereply.html (renamed from toolkit/components/extensions/test/mochitest/test_ext_sendmessage_doublereply.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/test_ext_sendmessage_no_receiver.html (renamed from toolkit/components/extensions/test/mochitest/test_ext_sendmessage_no_receiver.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/test_ext_sendmessage_reply.html (renamed from toolkit/components/extensions/test/mochitest/test_ext_sendmessage_reply.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/test_ext_sendmessage_reply2.html181
-rw-r--r--toolkit/components/webextensions/test/mochitest/test_ext_storage_content.html (renamed from toolkit/components/extensions/test/mochitest/test_ext_storage_content.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/test_ext_storage_tab.html (renamed from toolkit/components/extensions/test/mochitest/test_ext_storage_tab.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/test_ext_subframes_privileges.html (renamed from toolkit/components/extensions/test/mochitest/test_ext_subframes_privileges.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/test_ext_tab_teardown.html (renamed from toolkit/components/extensions/test/mochitest/test_ext_tab_teardown.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/test_ext_test.html (renamed from toolkit/components/extensions/test/mochitest/test_ext_test.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/test_ext_unload_frame.html (renamed from toolkit/components/extensions/test/mochitest/test_ext_unload_frame.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/test_ext_web_accessible_resources.html (renamed from toolkit/components/extensions/test/mochitest/test_ext_web_accessible_resources.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/test_ext_webnavigation.html (renamed from toolkit/components/extensions/test/mochitest/test_ext_webnavigation.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/test_ext_webnavigation_filters.html (renamed from toolkit/components/extensions/test/mochitest/test_ext_webnavigation_filters.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/test_ext_webrequest_background_events.html (renamed from toolkit/components/extensions/test/mochitest/test_ext_webrequest_background_events.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/test_ext_webrequest_basic.html (renamed from toolkit/components/extensions/test/mochitest/test_ext_webrequest_basic.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/test_ext_webrequest_suspend.html (renamed from toolkit/components/extensions/test/mochitest/test_ext_webrequest_suspend.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/test_ext_webrequest_upload.html (renamed from toolkit/components/extensions/test/mochitest/test_ext_webrequest_upload.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/test_ext_window_postMessage.html (renamed from toolkit/components/extensions/test/mochitest/test_ext_window_postMessage.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/test_ext_xhr_capabilities.html (renamed from toolkit/components/extensions/test/mochitest/test_ext_xhr_capabilities.html)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/webrequest_chromeworker.js (renamed from toolkit/components/extensions/test/mochitest/webrequest_chromeworker.js)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/webrequest_test.jsm (renamed from toolkit/components/extensions/test/mochitest/webrequest_test.jsm)0
-rw-r--r--toolkit/components/webextensions/test/mochitest/webrequest_worker.js (renamed from toolkit/components/extensions/test/mochitest/webrequest_worker.js)0
-rw-r--r--toolkit/components/webextensions/test/xpcshell/.eslintrc.js (renamed from toolkit/components/extensions/test/xpcshell/.eslintrc.js)0
-rw-r--r--toolkit/components/webextensions/test/xpcshell/data/file_download.html (renamed from toolkit/components/extensions/test/xpcshell/data/file_download.html)0
-rw-r--r--toolkit/components/webextensions/test/xpcshell/data/file_download.txt (renamed from toolkit/components/extensions/test/xpcshell/data/file_download.txt)0
-rw-r--r--toolkit/components/webextensions/test/xpcshell/head.js (renamed from toolkit/components/extensions/test/xpcshell/head.js)0
-rw-r--r--toolkit/components/webextensions/test/xpcshell/head_native_messaging.js (renamed from toolkit/components/extensions/test/xpcshell/head_native_messaging.js)0
-rw-r--r--toolkit/components/webextensions/test/xpcshell/head_sync.js (renamed from toolkit/components/extensions/test/xpcshell/head_sync.js)0
-rw-r--r--toolkit/components/webextensions/test/xpcshell/native_messaging.ini (renamed from toolkit/components/extensions/test/xpcshell/native_messaging.ini)0
-rw-r--r--toolkit/components/webextensions/test/xpcshell/test_csp_custom_policies.js (renamed from toolkit/components/extensions/test/xpcshell/test_csp_custom_policies.js)0
-rw-r--r--toolkit/components/webextensions/test/xpcshell/test_csp_validator.js (renamed from toolkit/components/extensions/test/xpcshell/test_csp_validator.js)0
-rw-r--r--toolkit/components/webextensions/test/xpcshell/test_ext_alarms.js (renamed from toolkit/components/extensions/test/xpcshell/test_ext_alarms.js)0
-rw-r--r--toolkit/components/webextensions/test/xpcshell/test_ext_alarms_does_not_fire.js (renamed from toolkit/components/extensions/test/xpcshell/test_ext_alarms_does_not_fire.js)0
-rw-r--r--toolkit/components/webextensions/test/xpcshell/test_ext_alarms_periodic.js (renamed from toolkit/components/extensions/test/xpcshell/test_ext_alarms_periodic.js)0
-rw-r--r--toolkit/components/webextensions/test/xpcshell/test_ext_alarms_replaces.js (renamed from toolkit/components/extensions/test/xpcshell/test_ext_alarms_replaces.js)0
-rw-r--r--toolkit/components/webextensions/test/xpcshell/test_ext_api_permissions.js (renamed from toolkit/components/extensions/test/xpcshell/test_ext_api_permissions.js)0
-rw-r--r--toolkit/components/webextensions/test/xpcshell/test_ext_apimanager.js (renamed from toolkit/components/extensions/test/xpcshell/test_ext_apimanager.js)0
-rw-r--r--toolkit/components/webextensions/test/xpcshell/test_ext_background_generated_load_events.js (renamed from toolkit/components/extensions/test/xpcshell/test_ext_background_generated_load_events.js)0
-rw-r--r--toolkit/components/webextensions/test/xpcshell/test_ext_background_generated_reload.js (renamed from toolkit/components/extensions/test/xpcshell/test_ext_background_generated_reload.js)0
-rw-r--r--toolkit/components/webextensions/test/xpcshell/test_ext_background_global_history.js (renamed from toolkit/components/extensions/test/xpcshell/test_ext_background_global_history.js)0
-rw-r--r--toolkit/components/webextensions/test/xpcshell/test_ext_background_private_browsing.js (renamed from toolkit/components/extensions/test/xpcshell/test_ext_background_private_browsing.js)0
-rw-r--r--toolkit/components/webextensions/test/xpcshell/test_ext_background_runtime_connect_params.js (renamed from toolkit/components/extensions/test/xpcshell/test_ext_background_runtime_connect_params.js)0
-rw-r--r--toolkit/components/webextensions/test/xpcshell/test_ext_background_sub_windows.js (renamed from toolkit/components/extensions/test/xpcshell/test_ext_background_sub_windows.js)0
-rw-r--r--toolkit/components/webextensions/test/xpcshell/test_ext_background_window_properties.js (renamed from toolkit/components/extensions/test/xpcshell/test_ext_background_window_properties.js)0
-rw-r--r--toolkit/components/webextensions/test/xpcshell/test_ext_contexts.js (renamed from toolkit/components/extensions/test/xpcshell/test_ext_contexts.js)0
-rw-r--r--toolkit/components/webextensions/test/xpcshell/test_ext_downloads.js (renamed from toolkit/components/extensions/test/xpcshell/test_ext_downloads.js)0
-rw-r--r--toolkit/components/webextensions/test/xpcshell/test_ext_downloads_download.js (renamed from toolkit/components/extensions/test/xpcshell/test_ext_downloads_download.js)0
-rw-r--r--toolkit/components/webextensions/test/xpcshell/test_ext_downloads_misc.js (renamed from toolkit/components/extensions/test/xpcshell/test_ext_downloads_misc.js)0
-rw-r--r--toolkit/components/webextensions/test/xpcshell/test_ext_downloads_search.js (renamed from toolkit/components/extensions/test/xpcshell/test_ext_downloads_search.js)0
-rw-r--r--toolkit/components/webextensions/test/xpcshell/test_ext_experiments.js (renamed from toolkit/components/extensions/test/xpcshell/test_ext_experiments.js)0
-rw-r--r--toolkit/components/webextensions/test/xpcshell/test_ext_extension.js (renamed from toolkit/components/extensions/test/xpcshell/test_ext_extension.js)0
-rw-r--r--toolkit/components/webextensions/test/xpcshell/test_ext_idle.js (renamed from toolkit/components/extensions/test/xpcshell/test_ext_idle.js)0
-rw-r--r--toolkit/components/webextensions/test/xpcshell/test_ext_json_parser.js (renamed from toolkit/components/extensions/test/xpcshell/test_ext_json_parser.js)0
-rw-r--r--toolkit/components/webextensions/test/xpcshell/test_ext_legacy_extension_context.js (renamed from toolkit/components/extensions/test/xpcshell/test_ext_legacy_extension_context.js)4
-rw-r--r--toolkit/components/webextensions/test/xpcshell/test_ext_legacy_extension_embedding.js (renamed from toolkit/components/extensions/test/xpcshell/test_ext_legacy_extension_embedding.js)0
-rw-r--r--toolkit/components/webextensions/test/xpcshell/test_ext_localStorage.js (renamed from toolkit/components/extensions/test/xpcshell/test_ext_localStorage.js)0
-rw-r--r--toolkit/components/webextensions/test/xpcshell/test_ext_management.js (renamed from toolkit/components/extensions/test/xpcshell/test_ext_management.js)0
-rw-r--r--toolkit/components/webextensions/test/xpcshell/test_ext_management_uninstall_self.js (renamed from toolkit/components/extensions/test/xpcshell/test_ext_management_uninstall_self.js)0
-rw-r--r--toolkit/components/webextensions/test/xpcshell/test_ext_manifest_content_security_policy.js (renamed from toolkit/components/extensions/test/xpcshell/test_ext_manifest_content_security_policy.js)0
-rw-r--r--toolkit/components/webextensions/test/xpcshell/test_ext_manifest_incognito.js (renamed from toolkit/components/extensions/test/xpcshell/test_ext_manifest_incognito.js)0
-rw-r--r--toolkit/components/webextensions/test/xpcshell/test_ext_manifest_minimum_chrome_version.js (renamed from toolkit/components/extensions/test/xpcshell/test_ext_manifest_minimum_chrome_version.js)0
-rw-r--r--toolkit/components/webextensions/test/xpcshell/test_ext_native_messaging.js (renamed from toolkit/components/extensions/test/xpcshell/test_ext_native_messaging.js)0
-rw-r--r--toolkit/components/webextensions/test/xpcshell/test_ext_native_messaging_perf.js (renamed from toolkit/components/extensions/test/xpcshell/test_ext_native_messaging_perf.js)0
-rw-r--r--toolkit/components/webextensions/test/xpcshell/test_ext_native_messaging_unresponsive.js (renamed from toolkit/components/extensions/test/xpcshell/test_ext_native_messaging_unresponsive.js)0
-rw-r--r--toolkit/components/webextensions/test/xpcshell/test_ext_onmessage_removelistener.js (renamed from toolkit/components/extensions/test/xpcshell/test_ext_onmessage_removelistener.js)0
-rw-r--r--toolkit/components/webextensions/test/xpcshell/test_ext_runtime_connect_no_receiver.js (renamed from toolkit/components/extensions/test/xpcshell/test_ext_runtime_connect_no_receiver.js)0
-rw-r--r--toolkit/components/webextensions/test/xpcshell/test_ext_runtime_getBrowserInfo.js (renamed from toolkit/components/extensions/test/xpcshell/test_ext_runtime_getBrowserInfo.js)0
-rw-r--r--toolkit/components/webextensions/test/xpcshell/test_ext_runtime_getPlatformInfo.js (renamed from toolkit/components/extensions/test/xpcshell/test_ext_runtime_getPlatformInfo.js)0
-rw-r--r--toolkit/components/webextensions/test/xpcshell/test_ext_runtime_onInstalled_and_onStartup.js (renamed from toolkit/components/extensions/test/xpcshell/test_ext_runtime_onInstalled_and_onStartup.js)0
-rw-r--r--toolkit/components/webextensions/test/xpcshell/test_ext_runtime_sendMessage.js (renamed from toolkit/components/extensions/test/xpcshell/test_ext_runtime_sendMessage.js)0
-rw-r--r--toolkit/components/webextensions/test/xpcshell/test_ext_runtime_sendMessage_errors.js (renamed from toolkit/components/extensions/test/xpcshell/test_ext_runtime_sendMessage_errors.js)0
-rw-r--r--toolkit/components/webextensions/test/xpcshell/test_ext_runtime_sendMessage_no_receiver.js (renamed from toolkit/components/extensions/test/xpcshell/test_ext_runtime_sendMessage_no_receiver.js)0
-rw-r--r--toolkit/components/webextensions/test/xpcshell/test_ext_runtime_sendMessage_self.js (renamed from toolkit/components/extensions/test/xpcshell/test_ext_runtime_sendMessage_self.js)0
-rw-r--r--toolkit/components/webextensions/test/xpcshell/test_ext_schemas.js (renamed from toolkit/components/extensions/test/xpcshell/test_ext_schemas.js)0
-rw-r--r--toolkit/components/webextensions/test/xpcshell/test_ext_schemas_allowed_contexts.js (renamed from toolkit/components/extensions/test/xpcshell/test_ext_schemas_allowed_contexts.js)0
-rw-r--r--toolkit/components/webextensions/test/xpcshell/test_ext_schemas_api_injection.js (renamed from toolkit/components/extensions/test/xpcshell/test_ext_schemas_api_injection.js)0
-rw-r--r--toolkit/components/webextensions/test/xpcshell/test_ext_schemas_async.js (renamed from toolkit/components/extensions/test/xpcshell/test_ext_schemas_async.js)0
-rw-r--r--toolkit/components/webextensions/test/xpcshell/test_ext_simple.js (renamed from toolkit/components/extensions/test/xpcshell/test_ext_simple.js)0
-rw-r--r--toolkit/components/webextensions/test/xpcshell/test_ext_storage.js (renamed from toolkit/components/extensions/test/xpcshell/test_ext_storage.js)0
-rw-r--r--toolkit/components/webextensions/test/xpcshell/test_ext_topSites.js (renamed from toolkit/components/extensions/test/xpcshell/test_ext_topSites.js)0
-rw-r--r--toolkit/components/webextensions/test/xpcshell/test_getAPILevelForWindow.js (renamed from toolkit/components/extensions/test/xpcshell/test_getAPILevelForWindow.js)0
-rw-r--r--toolkit/components/webextensions/test/xpcshell/test_locale_converter.js (renamed from toolkit/components/extensions/test/xpcshell/test_locale_converter.js)0
-rw-r--r--toolkit/components/webextensions/test/xpcshell/test_locale_data.js (renamed from toolkit/components/extensions/test/xpcshell/test_locale_data.js)0
-rw-r--r--toolkit/components/webextensions/test/xpcshell/test_native_messaging.js (renamed from toolkit/components/extensions/test/xpcshell/test_native_messaging.js)0
-rw-r--r--toolkit/components/webextensions/test/xpcshell/xpcshell.ini (renamed from toolkit/components/extensions/test/xpcshell/xpcshell.ini)0
-rw-r--r--toolkit/components/xulstore/XULStore.js18
299 files changed, 2695 insertions, 415 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/nsAlertsService.cpp b/toolkit/components/alerts/nsAlertsService.cpp
index 35418dd17..dd67ad983 100644
--- a/toolkit/components/alerts/nsAlertsService.cpp
+++ b/toolkit/components/alerts/nsAlertsService.cpp
@@ -22,6 +22,10 @@
#include "nsIFaviconService.h"
#endif // MOZ_PLACES
+#ifdef XP_WIN
+#include <shellapi.h>
+#endif
+
using namespace mozilla;
using mozilla::dom::ContentChild;
@@ -154,23 +158,12 @@ bool nsAlertsService::ShouldShowAlert()
bool result = true;
#ifdef XP_WIN
- HMODULE shellDLL = ::LoadLibraryW(L"shell32.dll");
- if (!shellDLL)
- return result;
-
- SHQueryUserNotificationStatePtr pSHQueryUserNotificationState =
- (SHQueryUserNotificationStatePtr) ::GetProcAddress(shellDLL, "SHQueryUserNotificationState");
-
- if (pSHQueryUserNotificationState) {
- MOZ_QUERY_USER_NOTIFICATION_STATE qstate;
- if (SUCCEEDED(pSHQueryUserNotificationState(&qstate))) {
- if (qstate != QUNS_ACCEPTS_NOTIFICATIONS) {
- result = false;
- }
+ QUERY_USER_NOTIFICATION_STATE qstate;
+ if (SUCCEEDED(SHQueryUserNotificationState(&qstate))) {
+ if (qstate != QUNS_ACCEPTS_NOTIFICATIONS) {
+ result = false;
}
}
-
- ::FreeLibrary(shellDLL);
#endif
return result;
diff --git a/toolkit/components/alerts/nsAlertsService.h b/toolkit/components/alerts/nsAlertsService.h
index 3f23eaabf..d2b2e1e6c 100644
--- a/toolkit/components/alerts/nsAlertsService.h
+++ b/toolkit/components/alerts/nsAlertsService.h
@@ -10,23 +10,6 @@
#include "nsCOMPtr.h"
#include "nsXULAlerts.h"
-#ifdef XP_WIN
-typedef enum tagMOZ_QUERY_USER_NOTIFICATION_STATE {
- QUNS_NOT_PRESENT = 1,
- QUNS_BUSY = 2,
- QUNS_RUNNING_D3D_FULL_SCREEN = 3,
- QUNS_PRESENTATION_MODE = 4,
- QUNS_ACCEPTS_NOTIFICATIONS = 5,
- QUNS_QUIET_TIME = 6,
- QUNS_IMMERSIVE = 7
-} MOZ_QUERY_USER_NOTIFICATION_STATE;
-
-extern "C" {
-// This function is Windows Vista or later
-typedef HRESULT (__stdcall *SHQueryUserNotificationStatePtr)(MOZ_QUERY_USER_NOTIFICATION_STATE *pquns);
-}
-#endif // defined(XP_WIN)
-
class nsAlertsService : public nsIAlertsService,
public nsIAlertsDoNotDisturb
{
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 523ec378e..ce60ab0fa 100644
--- a/toolkit/components/alerts/resources/content/alert.js
+++ b/toolkit/components/alerts/resources/content/alert.js
@@ -7,7 +7,21 @@ var {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
Cu.import("resource://gre/modules/AppConstants.jsm");
Cu.import("resource://gre/modules/Services.jsm");
-// Copied from nsILookAndFeel.h, see comments on eMetric_AlertNotificationOrigin
+/*
+ * This indicates from which corner of the screen alerts slide in,
+ * and from which direction (horizontal/vertical).
+ * 0, the default, represents bottom right, sliding vertically.
+ * Use any bitwise combination of the following constants:
+ * NS_ALERT_HORIZONTAL (1), NS_ALERT_LEFT (2), NS_ALERT_TOP (4).
+ *
+ * 6 4
+ * +-----------+
+ * 7| |5
+ * | |
+ * 3| |1
+ * +-----------+
+ * 2 0
+ */
const NS_ALERT_HORIZONTAL = 1;
const NS_ALERT_LEFT = 2;
const NS_ALERT_TOP = 4;
@@ -41,6 +55,8 @@ function prefillAlertInfo() {
// arguments[11] -> the nsIURI.hostPort of the origin, optional
// arguments[12] -> the alert icon URL, optional
+ document.getElementById('alertTime').setAttribute('value', (new Date).getTime());
+
switch (window.arguments.length) {
default:
case 13: {
@@ -150,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";
@@ -170,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) {
@@ -181,6 +202,7 @@ function onAlertLoad() {
window.close();
}
}, false);
+ alertBox.style.animationDuration = Math.round(alertDurationImmediate / 1000).toString() + "s";
alertBox.setAttribute("animate", true);
}
}
@@ -235,7 +257,15 @@ function moveWindowToEnd() {
let windows = Services.wm.getEnumerator("alert:alert");
while (windows.hasMoreElements()) {
let alertWindow = windows.getNext();
- if (alertWindow != window) {
+ let alertWindowTime = Number(
+ alertWindow.document.getElementById('alertTime').getAttribute('value'));
+ let windowTime = Number(
+ window.document.getElementById('alertTime').getAttribute('value'));
+ // The time of window creation.
+ // Otherwise calling the notification twice (and more) in a row
+ // does not work.
+ // See https://bugzilla.mozilla.org/show_bug.cgi?id=1263155
+ if ((alertWindow != window) && (alertWindowTime <= windowTime)) {
if (gOrigin & NS_ALERT_TOP) {
y = Math.max(y, alertWindow.screenY + alertWindow.outerHeight - WINDOW_SHADOW_SPREAD);
} else {
diff --git a/toolkit/components/alerts/resources/content/alert.xul b/toolkit/components/alerts/resources/content/alert.xul
index 8597d9954..1549f4530 100644
--- a/toolkit/components/alerts/resources/content/alert.xul
+++ b/toolkit/components/alerts/resources/content/alert.xul
@@ -24,6 +24,7 @@
<script type="application/javascript" src="chrome://global/content/alerts/alert.js"/>
<vbox id="alertBox" class="alertBox">
+ <label id="alertTime" value="" hidden="true"/>
<box id="alertTitleBox">
<image id="alertIcon"/>
<label id="alertTitleLabel" class="alertTitle plain" crop="end"/>
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/build/nsToolkitCompsModule.cpp b/toolkit/components/build/nsToolkitCompsModule.cpp
index 675c8c92b..22bb434a0 100644
--- a/toolkit/components/build/nsToolkitCompsModule.cpp
+++ b/toolkit/components/build/nsToolkitCompsModule.cpp
@@ -35,7 +35,9 @@
#include "nsBrowserStatusFilter.h"
#include "mozilla/FinalizationWitnessService.h"
#include "mozilla/NativeOSFileInternals.h"
+#ifdef MOZ_WEBEXTENSIONS
#include "mozilla/AddonContentPolicy.h"
+#endif
#include "mozilla/AddonPathService.h"
#if defined(XP_WIN)
@@ -122,7 +124,9 @@ NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(FinalizationWitnessService, Init)
NS_GENERIC_FACTORY_CONSTRUCTOR(NativeOSFileInternalsService)
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(NativeFileWatcherService, Init)
+#ifdef MOZ_WEBEXTENSIONS
NS_GENERIC_FACTORY_CONSTRUCTOR(AddonContentPolicy)
+#endif
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(AddonPathService, AddonPathService::GetInstance)
NS_DEFINE_NAMED_CID(NS_TOOLKIT_APPSTARTUP_CID);
@@ -155,7 +159,9 @@ NS_DEFINE_NAMED_CID(NS_UPDATEPROCESSOR_CID);
#endif
NS_DEFINE_NAMED_CID(FINALIZATIONWITNESSSERVICE_CID);
NS_DEFINE_NAMED_CID(NATIVE_OSFILE_INTERNALS_SERVICE_CID);
+#ifdef MOZ_WEBEXTENSIONS
NS_DEFINE_NAMED_CID(NS_ADDONCONTENTPOLICY_CID);
+#endif
NS_DEFINE_NAMED_CID(NS_ADDON_PATH_SERVICE_CID);
NS_DEFINE_NAMED_CID(NATIVE_FILEWATCHER_SERVICE_CID);
@@ -189,7 +195,9 @@ static const Module::CIDEntry kToolkitCIDs[] = {
#endif
{ &kFINALIZATIONWITNESSSERVICE_CID, false, nullptr, FinalizationWitnessServiceConstructor },
{ &kNATIVE_OSFILE_INTERNALS_SERVICE_CID, false, nullptr, NativeOSFileInternalsServiceConstructor },
+#ifdef MOZ_WEBEXTENSIONS
{ &kNS_ADDONCONTENTPOLICY_CID, false, nullptr, AddonContentPolicyConstructor },
+#endif
{ &kNS_ADDON_PATH_SERVICE_CID, false, nullptr, AddonPathServiceConstructor },
{ &kNATIVE_FILEWATCHER_SERVICE_CID, false, nullptr, NativeFileWatcherServiceConstructor },
{ nullptr }
@@ -225,14 +233,18 @@ static const Module::ContractIDEntry kToolkitContracts[] = {
#endif
{ FINALIZATIONWITNESSSERVICE_CONTRACTID, &kFINALIZATIONWITNESSSERVICE_CID },
{ NATIVE_OSFILE_INTERNALS_SERVICE_CONTRACTID, &kNATIVE_OSFILE_INTERNALS_SERVICE_CID },
+#ifdef MOZ_WEBEXTENSIONS
{ NS_ADDONCONTENTPOLICY_CONTRACTID, &kNS_ADDONCONTENTPOLICY_CID },
+#endif
{ NS_ADDONPATHSERVICE_CONTRACTID, &kNS_ADDON_PATH_SERVICE_CID },
{ NATIVE_FILEWATCHER_SERVICE_CONTRACTID, &kNATIVE_FILEWATCHER_SERVICE_CID },
{ nullptr }
};
static const mozilla::Module::CategoryEntry kToolkitCategories[] = {
+#ifdef MOZ_WEBEXTENSIONS
{ "content-policy", NS_ADDONCONTENTPOLICY_CONTRACTID, NS_ADDONCONTENTPOLICY_CONTRACTID },
+#endif
{ nullptr }
};
diff --git a/toolkit/components/console/jsconsole-clhandler.js b/toolkit/components/console/jsconsole-clhandler.js
index 7e5d0ea51..1fff88890 100644
--- a/toolkit/components/console/jsconsole-clhandler.js
+++ b/toolkit/components/console/jsconsole-clhandler.js
@@ -31,7 +31,7 @@ jsConsoleHandler.prototype = {
cmdLine.preventDefault = true;
},
- helpInfo : " -jsconsole Open the Error console.\n",
+ helpInfo : " --jsconsole Open the Error console.\n",
classID: Components.ID("{2cd0c310-e127-44d0-88fc-4435c9ab4d4b}"),
QueryInterface: XPCOMUtils.generateQI([Ci.nsICommandLineHandler]),
diff --git a/toolkit/components/cookie/moz.build b/toolkit/components/cookie/moz.build
index e3ed99703..aac3a838c 100644
--- a/toolkit/components/cookie/moz.build
+++ b/toolkit/components/cookie/moz.build
@@ -4,7 +4,4 @@
# 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/.
-if CONFIG['MOZ_BUILD_APP'] == 'mobile/android':
- DEFINES['MOZ_FENNEC'] = True
-
JAR_MANIFESTS += ['jar.mn']
diff --git a/toolkit/components/ctypes/tests/jsctypes-test-finalizer.cpp b/toolkit/components/ctypes/tests/jsctypes-test-finalizer.cpp
index 79e21cc89..009ba917a 100644
--- a/toolkit/components/ctypes/tests/jsctypes-test-finalizer.cpp
+++ b/toolkit/components/ctypes/tests/jsctypes-test-finalizer.cpp
@@ -232,8 +232,8 @@ test_finalizer_acq_string_t(int i)
{
gFinalizerTestResources[i] = 1;
if (!gFinalizerTestNames[i]) {
- char* buf = new char[10];
- snprintf(buf, 10, "%d", i);
+ char* buf = new char[12];
+ snprintf(buf, 12, "%d", i);
gFinalizerTestNames[i] = buf;
return buf;
}
diff --git a/toolkit/components/extensions/test/mochitest/test_ext_sendmessage_reply2.html b/toolkit/components/extensions/test/mochitest/test_ext_sendmessage_reply2.html
deleted file mode 100644
index 1ebc1b40f..000000000
--- a/toolkit/components/extensions/test/mochitest/test_ext_sendmessage_reply2.html
+++ /dev/null
@@ -1,93 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
- <title>WebExtension test</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(token) {
- browser.runtime.onMessage.addListener((msg, sender, sendReply) => {
- browser.test.assertTrue(sender.tab.url.endsWith("file_sample.html"), "sender url correct");
-
- if (msg == "done") {
- browser.test.notifyPass("sendmessage_reply");
- return;
- }
-
- let tabId = sender.tab.id;
- browser.tabs.sendMessage(tabId, `${token}-tabMessage`);
-
- browser.test.assertEq(msg, token, "token matches");
- sendReply(`${token}-done`);
- });
-}
-
-function contentScript(token) {
- let gotTabMessage = false;
- let badTabMessage = false;
- browser.runtime.onMessage.addListener((msg, sender, sendReply) => {
- 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");
- });
-}
-
-function makeExtension() {
- let token = Math.random();
- let extensionData = {
- background: `(${backgroundScript})(${token})`,
- manifest: {
- "permissions": ["tabs"],
- "content_scripts": [{
- "matches": ["http://mochi.test/*/file_sample.html"],
- "js": ["content_script.js"],
- "run_at": "document_start",
- }],
- },
-
- files: {
- "content_script.js": `(${contentScript})(${token})`,
- },
- };
- return extensionData;
-}
-
-add_task(function* test_contentscript() {
- let extension1 = ExtensionTestUtils.loadExtension(makeExtension());
- let extension2 = ExtensionTestUtils.loadExtension(makeExtension());
-
- 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")]);
-
- win.close();
-
- yield extension1.unload();
- yield extension2.unload();
- info("extensions unloaded");
-});
-</script>
-
-</body>
-</html>
diff --git a/toolkit/components/feeds/FeedProcessor.js b/toolkit/components/feeds/FeedProcessor.js
index 88d0ad6ed..51b6b13c9 100644
--- a/toolkit/components/feeds/FeedProcessor.js
+++ b/toolkit/components/feeds/FeedProcessor.js
@@ -637,7 +637,8 @@ TextConstruct.prototype = {
else
return null;
- return this.parserUtils.parseFragment(this.text, 0, isXML,
+ let flags = Ci.nsIParserUtils.SanitizerDropForms;
+ return this.parserUtils.parseFragment(this.text, flags, isXML,
this.base, element);
},
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 5fed9212a..7439d9d11 100644
--- a/toolkit/components/jsdownloads/src/DownloadIntegration.jsm
+++ b/toolkit/components/jsdownloads/src/DownloadIntegration.jsm
@@ -28,6 +28,8 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "AsyncShutdown",
"resource://gre/modules/AsyncShutdown.jsm");
+XPCOMUtils.defineLazyModuleGetter(this, "AppConstants",
+ "resource://gre/modules/AppConstants.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "DeferredTask",
"resource://gre/modules/DeferredTask.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Downloads",
@@ -528,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
@@ -675,20 +691,6 @@ this.DownloadIntegration = {
launchDownload: Task.async(function* (aDownload) {
let file = new FileUtils.File(aDownload.target.path);
-#ifndef XP_WIN
- // Ask for confirmation if the file is executable, except on Windows where
- // the operating system will show the prompt based on the security zone.
- // We do this here, instead of letting the caller handle the prompt
- // separately in the user interface layer, for two reasons. The first is
- // because of its security nature, so that add-ons cannot forget to do
- // this check. The second is that the system-level security prompt would
- // be displayed at launch time in any case.
- if (file.isExecutable() &&
- !(yield this.confirmLaunchExecutable(file.path))) {
- return;
- }
-#endif
-
// In case of a double extension, like ".tar.gz", we only
// consider the last one, because the MIME service cannot
// handle multiple extensions.
@@ -698,6 +700,21 @@ this.DownloadIntegration = {
fileExtension = match[1];
}
+ let isWindowsExe = AppConstants.platform == "win" &&
+ fileExtension.toLowerCase() == "exe";
+
+ // Ask for confirmation if the file is executable, except for .exe on
+ // Windows where the operating system will show the prompt based on the
+ // security zone. We do this here, instead of letting the caller handle
+ // the prompt separately in the user interface layer, for two reasons. The
+ // first is because of its security nature, so that add-ons cannot forget
+ // to do this check. The second is that the system-level security prompt
+ // would be displayed at launch time in any case.
+ if (file.isExecutable() && !isWindowsExe &&
+ !(yield this.confirmLaunchExecutable(file.path))) {
+ return;
+ }
+
try {
// The MIME service might throw if contentType == "" and it can't find
// a MIME type for the given extension, so we'll treat this case as
diff --git a/toolkit/components/maintenanceservice/bootstrapinstaller/maintenanceservice_installer.nsi b/toolkit/components/maintenanceservice/bootstrapinstaller/maintenanceservice_installer.nsi
index 9e831dc9c..d4d21e377 100644
--- a/toolkit/components/maintenanceservice/bootstrapinstaller/maintenanceservice_installer.nsi
+++ b/toolkit/components/maintenanceservice/bootstrapinstaller/maintenanceservice_installer.nsi
@@ -117,10 +117,7 @@ Function .onInit
System::Call 'kernel32::SetDllDirectoryW(w "")'
SetSilent silent
- ; On Windows 2000 we do not install the maintenance service.
- ; We won't run this installer from the parent installer, but just in case
- ; someone tries to execute it on Windows 2000...
- ${Unless} ${AtLeastWinXP}
+ ${Unless} ${AtLeastWin7}
Abort
${EndUnless}
FunctionEnd
diff --git a/toolkit/components/maintenanceservice/maintenanceservice.exe.manifest b/toolkit/components/maintenanceservice/maintenanceservice.exe.manifest
index cb317c47d..e6bfba8ca 100644
--- a/toolkit/components/maintenanceservice/maintenanceservice.exe.manifest
+++ b/toolkit/components/maintenanceservice/maintenanceservice.exe.manifest
@@ -20,7 +20,6 @@
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
- <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
</application>
</compatibility>
</assembly>
diff --git a/toolkit/components/moz.build b/toolkit/components/moz.build
index 509332800..5dba09a32 100644
--- a/toolkit/components/moz.build
+++ b/toolkit/components/moz.build
@@ -25,7 +25,6 @@ DIRS += [
'crashmonitor',
'diskspacewatcher',
'downloads',
- 'extensions',
'exthelper',
'filewatcher',
'finalizationwitness',
@@ -68,18 +67,18 @@ DIRS += [
'xulstore'
]
+if CONFIG['MOZ_WEBEXTENSIONS']:
+ DIRS += ['webextensions']
+
if CONFIG['ENABLE_INTL_API']:
DIRS += ['mozintl']
-if CONFIG['MOZ_BUILD_APP'] != 'mobile/android':
+if not CONFIG['MOZ_FENNEC']:
DIRS += ['narrate', 'viewsource'];
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/moz.build b/toolkit/components/passwordmgr/moz.build
index 72c8c70a4..e54e6ba2d 100644
--- a/toolkit/components/passwordmgr/moz.build
+++ b/toolkit/components/passwordmgr/moz.build
@@ -4,7 +4,7 @@
# 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/.
-if CONFIG['MOZ_BUILD_APP'] == 'browser':
+if CONFIG['MOZ_PHOENIX']:
DEFINES['MOZ_BUILD_APP_IS_BROWSER'] = True
MOCHITEST_MANIFESTS += ['test/mochitest.ini', 'test/mochitest/mochitest.ini']
@@ -67,7 +67,7 @@ if CONFIG['OS_TARGET'] == 'WINNT':
'OSCrypto_win.js',
]
-if CONFIG['MOZ_BUILD_APP'] == 'browser':
+if CONFIG['MOZ_PHOENIX']:
EXTRA_JS_MODULES += [
'LoginManagerContextMenu.jsm',
]
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/BookmarkHTMLUtils.jsm b/toolkit/components/places/BookmarkHTMLUtils.jsm
index a009a5e7c..c10ef85d6 100644
--- a/toolkit/components/places/BookmarkHTMLUtils.jsm
+++ b/toolkit/components/places/BookmarkHTMLUtils.jsm
@@ -746,6 +746,7 @@ BookmarkImporter.prototype = {
this._curFrame.inDescription = true;
break;
case "hr":
+ this._closeContainer(aElt);
this._handleSeparator(aElt);
break;
}
@@ -1046,7 +1047,12 @@ BookmarkExporter.prototype = {
},
_writeLine: function (aText) {
- this._write(aText + "\n");
+ if (Services.sysinfo.getProperty("name") == "Windows_NT") {
+ // Write CRLF line endings on Windows
+ this._write(aText + "\r\n");
+ } else {
+ this._write(aText + "\n");
+ }
},
_writeHeader: function () {
@@ -1145,7 +1151,7 @@ BookmarkExporter.prototype = {
if (aItem.charset)
this._writeAttribute("LAST_CHARSET", escapeHtmlEntities(aItem.charset));
if (aItem.tags)
- this._writeAttribute("TAGS", aItem.tags);
+ this._writeAttribute("TAGS", escapeHtmlEntities(aItem.tags));
this._writeLine(">" + escapeHtmlEntities(aItem.title) + "</A>");
this._writeDescription(aItem, aIndent);
},
diff --git a/toolkit/components/places/PlacesUtils.jsm b/toolkit/components/places/PlacesUtils.jsm
index 4b7bcb82a..fc303ca8a 100644
--- a/toolkit/components/places/PlacesUtils.jsm
+++ b/toolkit/components/places/PlacesUtils.jsm
@@ -53,6 +53,8 @@ XPCOMUtils.defineLazyModuleGetter(this, "AsyncShutdown",
"resource://gre/modules/AsyncShutdown.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "PlacesSyncUtils",
"resource://gre/modules/PlacesSyncUtils.jsm");
+XPCOMUtils.defineLazyModuleGetter(this, "PlacesUIUtils",
+ "resource:///modules/PlacesUIUtils.jsm");
// The minimum amount of transactions before starting a batch. Usually we do
// do incremental updates, a batch will cause views to completely
@@ -3248,8 +3250,11 @@ PlacesRemoveItemTransaction.prototype = {
let contents =
PlacesUtils.getFolderContents(this.item.id, false, false).root;
for (let i = 0; i < contents.childCount; ++i) {
- let txn = new PlacesRemoveItemTransaction(contents.getChild(i).itemId);
- transactions.push(txn);
+ let childId = contents.getChild(i).itemId;
+ if (!PlacesUIUtils._isLivemark(childId)) {
+ let txn = new PlacesRemoveItemTransaction(childId);
+ transactions.push(txn);
+ }
}
contents.containerOpen = false;
// Reverse transactions to preserve parent-child relationship.
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/search/moz.build b/toolkit/components/search/moz.build
index 98ccf2b8d..0a2695152 100644
--- a/toolkit/components/search/moz.build
+++ b/toolkit/components/search/moz.build
@@ -7,11 +7,14 @@
XPCSHELL_TESTS_MANIFESTS += ['tests/xpcshell/xpcshell.ini']
EXTRA_COMPONENTS += [
- 'nsSearchService.js',
'nsSearchSuggestions.js',
]
-if CONFIG['MOZ_BUILD_APP'] in ['browser', 'mobile/android', 'xulrunner']:
+EXTRA_PP_COMPONENTS += [
+ 'nsSearchService.js',
+]
+
+if CONFIG['MOZ_PHOENIX'] or CONFIG['MOZ_FENNEC'] or CONFIG['MOZ_XULRUNNER']:
DEFINES['HAVE_SIDEBAR'] = True
EXTRA_COMPONENTS += [
'nsSidebar.js',
diff --git a/toolkit/components/search/nsSearchService.js b/toolkit/components/search/nsSearchService.js
index bbe66ba7e..fb3f69f4c 100644
--- a/toolkit/components/search/nsSearchService.js
+++ b/toolkit/components/search/nsSearchService.js
@@ -107,7 +107,7 @@ const NEW_LINES = /(\r\n|\r|\n)/;
// Set an arbitrary cap on the maximum icon size. Without this, large icons can
// cause big delays when loading them at startup.
-const MAX_ICON_SIZE = 10000;
+const MAX_ICON_SIZE = 32768;
// Default charset to use for sending search parameters. ISO-8859-1 is used to
// match previous nsInternetSearchService behavior.
@@ -4676,9 +4676,9 @@ SearchService.prototype = {
Services.obs.addObserver(this, SEARCH_ENGINE_TOPIC, false);
Services.obs.addObserver(this, QUIT_APPLICATION_TOPIC, false);
- if (AppConstants.MOZ_BUILD_APP == "mobile/android") {
- Services.prefs.addObserver(LOCALE_PREF, this, false);
- }
+#ifdef MOZ_FENNEC
+ Services.prefs.addObserver(LOCALE_PREF, this, false);
+#endif
// The current stage of shutdown. Used to help analyze crash
// signatures in case of shutdown timeout.
@@ -4721,9 +4721,9 @@ SearchService.prototype = {
Services.obs.removeObserver(this, SEARCH_ENGINE_TOPIC);
Services.obs.removeObserver(this, QUIT_APPLICATION_TOPIC);
- if (AppConstants.MOZ_BUILD_APP == "mobile/android") {
- Services.prefs.removeObserver(LOCALE_PREF, this);
- }
+#ifdef MOZ_FENNEC
+ Services.prefs.removeObserver(LOCALE_PREF, this);
+#endif
},
QueryInterface: XPCOMUtils.generateQI([
diff --git a/toolkit/components/telemetry/Histograms.json b/toolkit/components/telemetry/Histograms.json
index aa66fbe14..ade308cfa 100644
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -1502,12 +1502,24 @@
"n_buckets": 50,
"description": "HTTP page: DNS lookup time (ms)"
},
- "HTTP_PAGE_TCP_CONNECTION": {
+ "HTTP_PAGE_TLS_HANDSHAKE": {
+ "alert_emails": ["necko@mozilla.com", "pmcmanus@mozilla.com"],
+ "bug_numbers": [772589],
"expires_in_version": "never",
"kind": "exponential",
"high": 30000,
"n_buckets": 50,
- "description": "HTTP page: TCP connection setup (ms)"
+ "description": "HTTP page channel: After TCP SYN to Ready for HTTP (ms)"
+
+ },
+ "HTTP_PAGE_TCP_CONNECTION_2": {
+ "alert_emails": ["necko@mozilla.com", "pmcmanus@mozilla.com"],
+ "bug_numbers": [772589],
+ "expires_in_version": "never",
+ "kind": "exponential",
+ "high": 30000,
+ "n_buckets": 50,
+ "description": "HTTP page channel: TCP SYN to Ready for HTTP (ms)"
},
"HTTP_PAGE_OPEN_TO_FIRST_SENT": {
"expires_in_version": "never",
@@ -1621,12 +1633,23 @@
"n_buckets": 50,
"description": "HTTP subitem: DNS lookup time (ms)"
},
- "HTTP_SUB_TCP_CONNECTION": {
+ "HTTP_SUB_TLS_HANDSHAKE": {
+ "alert_emails": ["necko@mozilla.com", "pmcmanus@mozilla.com"],
+ "bug_numbers": [772589],
"expires_in_version": "never",
"kind": "exponential",
"high": 30000,
"n_buckets": 50,
- "description": "HTTP subitem: TCP connection setup (ms)"
+ "description": "HTTP subitem channel: After TCP SYN to Ready for HTTP (ms)"
+ },
+ "HTTP_SUB_TCP_CONNECTION_2": {
+ "alert_emails": ["necko@mozilla.com", "pmcmanus@mozilla.com"],
+ "bug_numbers": [772589],
+ "expires_in_version": "never",
+ "kind": "exponential",
+ "high": 30000,
+ "n_buckets": 50,
+ "description": "HTTP subitem channel: TCP SYN to Ready for HTTP (ms)"
},
"HTTP_SUB_OPEN_TO_FIRST_SENT": {
"expires_in_version": "never",
@@ -6903,39 +6926,6 @@
"n_buckets": 1000,
"description": "The time (in milliseconds) that it took to display a selected source to the user."
},
- "MEDIA_RUST_MP4PARSE_SUCCESS": {
- "alert_emails": ["giles@mozilla.com", "kinetik@flim.org"],
- "expires_in_version": "55",
- "kind": "boolean",
- "bug_numbers": [1220885],
- "description": "(Bug 1220885) Whether the rust mp4 demuxer successfully parsed a stream segment.",
- "cpp_guard": "MOZ_RUST_MP4PARSE"
- },
- "MEDIA_RUST_MP4PARSE_ERROR_CODE": {
- "alert_emails": ["giles@mozilla.com", "kinetik@flim.org"],
- "expires_in_version": "55",
- "kind": "enumerated",
- "n_values": 32,
- "bug_numbers": [1238420],
- "description": "The error code reported when an MP4 parse attempt has failed.0 = OK, 1 = bad argument, 2 = invalid data, 3 = unsupported, 4 = unexpected end of file, 5 = read error.",
- "cpp_guard": "MOZ_RUST_MP4PARSE"
- },
- "MEDIA_RUST_MP4PARSE_TRACK_MATCH_AUDIO": {
- "alert_emails": ["giles@mozilla.com", "kinetik@flim.org"],
- "expires_in_version": "55",
- "kind": "boolean",
- "bug_numbers": [1231169],
- "description": "Whether rust and stagefight mp4 parser audio track results match.",
- "cpp_guard": "MOZ_RUST_MP4PARSE"
- },
- "MEDIA_RUST_MP4PARSE_TRACK_MATCH_VIDEO": {
- "alert_emails": ["giles@mozilla.com", "kinetik@flim.org"],
- "expires_in_version": "55",
- "kind": "boolean",
- "bug_numbers": [1231169],
- "description": "Whether rust and stagefight mp4 parser video track results match.",
- "cpp_guard": "MOZ_RUST_MP4PARSE"
- },
"MEDIA_WMF_DECODE_ERROR": {
"expires_in_version": "55",
"kind": "enumerated",
diff --git a/toolkit/components/telemetry/TelemetryEnvironment.jsm b/toolkit/components/telemetry/TelemetryEnvironment.jsm
index e2453649c..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() {
@@ -784,7 +756,7 @@ function EnvironmentCache() {
this._currentEnvironment.profile = {};
p.push(this._updateProfile());
- if (AppConstants.MOZ_BUILD_APP == "browser") {
+ if (AppConstants.MOZ_PHOENIX) {
p.push(this._updateAttribution());
}
diff --git a/toolkit/components/telemetry/histogram-whitelists.json b/toolkit/components/telemetry/histogram-whitelists.json
index 52db33192..486178199 100644
--- a/toolkit/components/telemetry/histogram-whitelists.json
+++ b/toolkit/components/telemetry/histogram-whitelists.json
@@ -333,7 +333,6 @@
"HTTP_PAGE_OPEN_TO_FIRST_RECEIVED",
"HTTP_PAGE_OPEN_TO_FIRST_SENT",
"HTTP_PAGE_REVALIDATION",
- "HTTP_PAGE_TCP_CONNECTION",
"HTTP_PROXY_TYPE",
"HTTP_REQUEST_PER_CONN",
"HTTP_REQUEST_PER_PAGE",
@@ -359,7 +358,6 @@
"HTTP_SUB_OPEN_TO_FIRST_RECEIVED",
"HTTP_SUB_OPEN_TO_FIRST_SENT",
"HTTP_SUB_REVALIDATION",
- "HTTP_SUB_TCP_CONNECTION",
"HTTP_TRANSACTION_IS_SSL",
"HTTP_TRANSACTION_USE_ALTSVC",
"HTTP_TRANSACTION_USE_ALTSVC_OE",
@@ -1167,7 +1165,6 @@
"HTTP_PAGE_OPEN_TO_FIRST_RECEIVED",
"HTTP_PAGE_OPEN_TO_FIRST_SENT",
"HTTP_PAGE_REVALIDATION",
- "HTTP_PAGE_TCP_CONNECTION",
"HTTP_PROXY_TYPE",
"HTTP_REQUEST_PER_CONN",
"HTTP_REQUEST_PER_PAGE",
@@ -1193,7 +1190,6 @@
"HTTP_SUB_OPEN_TO_FIRST_RECEIVED",
"HTTP_SUB_OPEN_TO_FIRST_SENT",
"HTTP_SUB_REVALIDATION",
- "HTTP_SUB_TCP_CONNECTION",
"HTTP_TRANSACTION_IS_SSL",
"HTTP_TRANSACTION_USE_ALTSVC",
"HTTP_TRANSACTION_USE_ALTSVC_OE",
diff --git a/toolkit/components/telemetry/tests/unit/xpcshell.ini b/toolkit/components/telemetry/tests/unit/xpcshell.ini
index 74067580a..fe58d362e 100644
--- a/toolkit/components/telemetry/tests/unit/xpcshell.ini
+++ b/toolkit/components/telemetry/tests/unit/xpcshell.ini
@@ -15,7 +15,7 @@ support-files =
system.xpi
restartless.xpi
theme.xpi
- !/toolkit/mozapps/extensions/test/xpcshell/head_addons.js
+ !/toolkit/mozapps/webextensions/test/xpcshell/head_addons.js
generated-files =
dictionary.xpi
experiment.xpi
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/extensions/.eslintrc.js b/toolkit/components/webextensions/.eslintrc.js
index 70196fc6a..70196fc6a 100644
--- a/toolkit/components/extensions/.eslintrc.js
+++ b/toolkit/components/webextensions/.eslintrc.js
diff --git a/toolkit/components/extensions/Extension.jsm b/toolkit/components/webextensions/Extension.jsm
index 3468f2594..3468f2594 100644
--- a/toolkit/components/extensions/Extension.jsm
+++ b/toolkit/components/webextensions/Extension.jsm
diff --git a/toolkit/components/extensions/ExtensionAPI.jsm b/toolkit/components/webextensions/ExtensionAPI.jsm
index 54dab8e3b..54dab8e3b 100644
--- a/toolkit/components/extensions/ExtensionAPI.jsm
+++ b/toolkit/components/webextensions/ExtensionAPI.jsm
diff --git a/toolkit/components/extensions/ExtensionChild.jsm b/toolkit/components/webextensions/ExtensionChild.jsm
index c953dd685..5dc4e2277 100644
--- a/toolkit/components/extensions/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/extensions/ExtensionCommon.jsm b/toolkit/components/webextensions/ExtensionCommon.jsm
index a339fb27e..9ec84b5c7 100644
--- a/toolkit/components/extensions/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/extensions/ExtensionContent.jsm b/toolkit/components/webextensions/ExtensionContent.jsm
index 9b9a02091..5f9b88f35 100644
--- a/toolkit/components/extensions/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/extensions/ExtensionManagement.jsm b/toolkit/components/webextensions/ExtensionManagement.jsm
index 324c5b71b..324c5b71b 100644
--- a/toolkit/components/extensions/ExtensionManagement.jsm
+++ b/toolkit/components/webextensions/ExtensionManagement.jsm
diff --git a/toolkit/components/extensions/ExtensionParent.jsm b/toolkit/components/webextensions/ExtensionParent.jsm
index b88500d1e..b88500d1e 100644
--- a/toolkit/components/extensions/ExtensionParent.jsm
+++ b/toolkit/components/webextensions/ExtensionParent.jsm
diff --git a/toolkit/components/extensions/ExtensionStorage.jsm b/toolkit/components/webextensions/ExtensionStorage.jsm
index 0b0ffb000..0b0ffb000 100644
--- a/toolkit/components/extensions/ExtensionStorage.jsm
+++ b/toolkit/components/webextensions/ExtensionStorage.jsm
diff --git a/toolkit/components/extensions/ExtensionTestCommon.jsm b/toolkit/components/webextensions/ExtensionTestCommon.jsm
index 02453ddfd..02453ddfd 100644
--- a/toolkit/components/extensions/ExtensionTestCommon.jsm
+++ b/toolkit/components/webextensions/ExtensionTestCommon.jsm
diff --git a/toolkit/components/extensions/ExtensionUtils.jsm b/toolkit/components/webextensions/ExtensionUtils.jsm
index e7f768c07..e7f768c07 100644
--- a/toolkit/components/extensions/ExtensionUtils.jsm
+++ b/toolkit/components/webextensions/ExtensionUtils.jsm
diff --git a/toolkit/components/extensions/ExtensionXPCShellUtils.jsm b/toolkit/components/webextensions/ExtensionXPCShellUtils.jsm
index 339709a19..339709a19 100644
--- a/toolkit/components/extensions/ExtensionXPCShellUtils.jsm
+++ b/toolkit/components/webextensions/ExtensionXPCShellUtils.jsm
diff --git a/toolkit/components/extensions/LegacyExtensionsUtils.jsm b/toolkit/components/webextensions/LegacyExtensionsUtils.jsm
index 7632548e3..e8d276fe9 100644
--- a/toolkit/components/extensions/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/extensions/MessageChannel.jsm b/toolkit/components/webextensions/MessageChannel.jsm
index c5b326405..c5b326405 100644
--- a/toolkit/components/extensions/MessageChannel.jsm
+++ b/toolkit/components/webextensions/MessageChannel.jsm
diff --git a/toolkit/components/extensions/NativeMessaging.jsm b/toolkit/components/webextensions/NativeMessaging.jsm
index 3d8658a3f..3d8658a3f 100644
--- a/toolkit/components/extensions/NativeMessaging.jsm
+++ b/toolkit/components/webextensions/NativeMessaging.jsm
diff --git a/toolkit/components/extensions/Schemas.jsm b/toolkit/components/webextensions/Schemas.jsm
index 159211c79..159211c79 100644
--- a/toolkit/components/extensions/Schemas.jsm
+++ b/toolkit/components/webextensions/Schemas.jsm
diff --git a/toolkit/components/extensions/ext-alarms.js b/toolkit/components/webextensions/ext-alarms.js
index 2171e7dba..2171e7dba 100644
--- a/toolkit/components/extensions/ext-alarms.js
+++ b/toolkit/components/webextensions/ext-alarms.js
diff --git a/toolkit/components/extensions/ext-backgroundPage.js b/toolkit/components/webextensions/ext-backgroundPage.js
index fce6100ca..fce6100ca 100644
--- a/toolkit/components/extensions/ext-backgroundPage.js
+++ b/toolkit/components/webextensions/ext-backgroundPage.js
diff --git a/toolkit/components/extensions/ext-browser-content.js b/toolkit/components/webextensions/ext-browser-content.js
index e14ca50d6..e14ca50d6 100644
--- a/toolkit/components/extensions/ext-browser-content.js
+++ b/toolkit/components/webextensions/ext-browser-content.js
diff --git a/toolkit/components/extensions/ext-c-backgroundPage.js b/toolkit/components/webextensions/ext-c-backgroundPage.js
index b5074dd9a..ca446ce79 100644
--- a/toolkit/components/extensions/ext-c-backgroundPage.js
+++ b/toolkit/components/webextensions/ext-c-backgroundPage.js
@@ -9,8 +9,8 @@ global.initializeBackgroundPage = (contentWindow) => {
if (!alertDisplayedWarning) {
require("devtools/client/framework/devtools-browser");
- let hudservice = require("devtools/client/webconsole/hudservice");
- hudservice.openBrowserConsoleOrFocus();
+ let {HUDService} = require("devtools/client/webconsole/hudservice");
+ HUDService.openBrowserConsoleOrFocus();
contentWindow.console.warn("alert() is not supported in background windows; please use console.log instead.");
diff --git a/toolkit/components/extensions/ext-c-extension.js b/toolkit/components/webextensions/ext-c-extension.js
index 669309bea..669309bea 100644
--- a/toolkit/components/extensions/ext-c-extension.js
+++ b/toolkit/components/webextensions/ext-c-extension.js
diff --git a/toolkit/components/extensions/ext-c-runtime.js b/toolkit/components/webextensions/ext-c-runtime.js
index 8adca60ca..1dcac35da 100644
--- a/toolkit/components/extensions/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/extensions/ext-c-storage.js b/toolkit/components/webextensions/ext-c-storage.js
index e8d53058f..e8d53058f 100644
--- a/toolkit/components/extensions/ext-c-storage.js
+++ b/toolkit/components/webextensions/ext-c-storage.js
diff --git a/toolkit/components/extensions/ext-c-test.js b/toolkit/components/webextensions/ext-c-test.js
index b0c92f79f..b0c92f79f 100644
--- a/toolkit/components/extensions/ext-c-test.js
+++ b/toolkit/components/webextensions/ext-c-test.js
diff --git a/toolkit/components/extensions/ext-cookies.js b/toolkit/components/webextensions/ext-cookies.js
index d0a703421..d0a703421 100644
--- a/toolkit/components/extensions/ext-cookies.js
+++ b/toolkit/components/webextensions/ext-cookies.js
diff --git a/toolkit/components/extensions/ext-downloads.js b/toolkit/components/webextensions/ext-downloads.js
index 132814ae4..132814ae4 100644
--- a/toolkit/components/extensions/ext-downloads.js
+++ b/toolkit/components/webextensions/ext-downloads.js
diff --git a/toolkit/components/extensions/ext-extension.js b/toolkit/components/webextensions/ext-extension.js
index c4bdc8b63..c4bdc8b63 100644
--- a/toolkit/components/extensions/ext-extension.js
+++ b/toolkit/components/webextensions/ext-extension.js
diff --git a/toolkit/components/extensions/ext-i18n.js b/toolkit/components/webextensions/ext-i18n.js
index bb4bde4bd..bb4bde4bd 100644
--- a/toolkit/components/extensions/ext-i18n.js
+++ b/toolkit/components/webextensions/ext-i18n.js
diff --git a/toolkit/components/extensions/ext-idle.js b/toolkit/components/webextensions/ext-idle.js
index c5be4b600..c5be4b600 100644
--- a/toolkit/components/extensions/ext-idle.js
+++ b/toolkit/components/webextensions/ext-idle.js
diff --git a/toolkit/components/extensions/ext-management.js b/toolkit/components/webextensions/ext-management.js
index 59a7959d7..59a7959d7 100644
--- a/toolkit/components/extensions/ext-management.js
+++ b/toolkit/components/webextensions/ext-management.js
diff --git a/toolkit/components/extensions/ext-notifications.js b/toolkit/components/webextensions/ext-notifications.js
index 1df96a2ac..1df96a2ac 100644
--- a/toolkit/components/extensions/ext-notifications.js
+++ b/toolkit/components/webextensions/ext-notifications.js
diff --git a/toolkit/components/extensions/ext-runtime.js b/toolkit/components/webextensions/ext-runtime.js
index aed3ffd4b..aed3ffd4b 100644
--- a/toolkit/components/extensions/ext-runtime.js
+++ b/toolkit/components/webextensions/ext-runtime.js
diff --git a/toolkit/components/extensions/ext-storage.js b/toolkit/components/webextensions/ext-storage.js
index b1e22c46c..b1e22c46c 100644
--- a/toolkit/components/extensions/ext-storage.js
+++ b/toolkit/components/webextensions/ext-storage.js
diff --git a/toolkit/components/extensions/ext-topSites.js b/toolkit/components/webextensions/ext-topSites.js
index a66ac85d9..a66ac85d9 100644
--- a/toolkit/components/extensions/ext-topSites.js
+++ b/toolkit/components/webextensions/ext-topSites.js
diff --git a/toolkit/components/extensions/ext-webNavigation.js b/toolkit/components/webextensions/ext-webNavigation.js
index 904f3a4a7..904f3a4a7 100644
--- a/toolkit/components/extensions/ext-webNavigation.js
+++ b/toolkit/components/webextensions/ext-webNavigation.js
diff --git a/toolkit/components/extensions/ext-webRequest.js b/toolkit/components/webextensions/ext-webRequest.js
index f92330131..f92330131 100644
--- a/toolkit/components/extensions/ext-webRequest.js
+++ b/toolkit/components/webextensions/ext-webRequest.js
diff --git a/toolkit/components/extensions/extensions-toolkit.manifest b/toolkit/components/webextensions/extensions-toolkit.manifest
index 4ec65a984..4ec65a984 100644
--- a/toolkit/components/extensions/extensions-toolkit.manifest
+++ b/toolkit/components/webextensions/extensions-toolkit.manifest
diff --git a/toolkit/components/extensions/jar.mn b/toolkit/components/webextensions/jar.mn
index 6d343e1b7..6d343e1b7 100644
--- a/toolkit/components/extensions/jar.mn
+++ b/toolkit/components/webextensions/jar.mn
diff --git a/toolkit/components/extensions/moz.build b/toolkit/components/webextensions/moz.build
index f32f526f9..f32f526f9 100644
--- a/toolkit/components/extensions/moz.build
+++ b/toolkit/components/webextensions/moz.build
diff --git a/toolkit/components/extensions/schemas/LICENSE b/toolkit/components/webextensions/schemas/LICENSE
index 9314092fd..9314092fd 100644
--- a/toolkit/components/extensions/schemas/LICENSE
+++ b/toolkit/components/webextensions/schemas/LICENSE
diff --git a/toolkit/components/extensions/schemas/alarms.json b/toolkit/components/webextensions/schemas/alarms.json
index 2a72a2842..2a72a2842 100644
--- a/toolkit/components/extensions/schemas/alarms.json
+++ b/toolkit/components/webextensions/schemas/alarms.json
diff --git a/toolkit/components/extensions/schemas/cookies.json b/toolkit/components/webextensions/schemas/cookies.json
index a7de6eb42..a7de6eb42 100644
--- a/toolkit/components/extensions/schemas/cookies.json
+++ b/toolkit/components/webextensions/schemas/cookies.json
diff --git a/toolkit/components/extensions/schemas/downloads.json b/toolkit/components/webextensions/schemas/downloads.json
index dcd43e4e1..dcd43e4e1 100644
--- a/toolkit/components/extensions/schemas/downloads.json
+++ b/toolkit/components/webextensions/schemas/downloads.json
diff --git a/toolkit/components/extensions/schemas/events.json b/toolkit/components/webextensions/schemas/events.json
index ea3cbb5d2..ea3cbb5d2 100644
--- a/toolkit/components/extensions/schemas/events.json
+++ b/toolkit/components/webextensions/schemas/events.json
diff --git a/toolkit/components/extensions/schemas/experiments.json b/toolkit/components/webextensions/schemas/experiments.json
index c687173a9..c687173a9 100644
--- a/toolkit/components/extensions/schemas/experiments.json
+++ b/toolkit/components/webextensions/schemas/experiments.json
diff --git a/toolkit/components/extensions/schemas/extension.json b/toolkit/components/webextensions/schemas/extension.json
index 5a1b6c935..5a1b6c935 100644
--- a/toolkit/components/extensions/schemas/extension.json
+++ b/toolkit/components/webextensions/schemas/extension.json
diff --git a/toolkit/components/extensions/schemas/extension_types.json b/toolkit/components/webextensions/schemas/extension_types.json
index 1a88e4e60..1a88e4e60 100644
--- a/toolkit/components/extensions/schemas/extension_types.json
+++ b/toolkit/components/webextensions/schemas/extension_types.json
diff --git a/toolkit/components/extensions/schemas/i18n.json b/toolkit/components/webextensions/schemas/i18n.json
index 12dc45dfc..12dc45dfc 100644
--- a/toolkit/components/extensions/schemas/i18n.json
+++ b/toolkit/components/webextensions/schemas/i18n.json
diff --git a/toolkit/components/extensions/schemas/idle.json b/toolkit/components/webextensions/schemas/idle.json
index e0b3b951e..e0b3b951e 100644
--- a/toolkit/components/extensions/schemas/idle.json
+++ b/toolkit/components/webextensions/schemas/idle.json
diff --git a/toolkit/components/extensions/schemas/jar.mn b/toolkit/components/webextensions/schemas/jar.mn
index 0bdf35b0d..0bdf35b0d 100644
--- a/toolkit/components/extensions/schemas/jar.mn
+++ b/toolkit/components/webextensions/schemas/jar.mn
diff --git a/toolkit/components/extensions/schemas/management.json b/toolkit/components/webextensions/schemas/management.json
index 413ff1d0d..413ff1d0d 100644
--- a/toolkit/components/extensions/schemas/management.json
+++ b/toolkit/components/webextensions/schemas/management.json
diff --git a/toolkit/components/extensions/schemas/manifest.json b/toolkit/components/webextensions/schemas/manifest.json
index 09e6b56fb..09e6b56fb 100644
--- a/toolkit/components/extensions/schemas/manifest.json
+++ b/toolkit/components/webextensions/schemas/manifest.json
diff --git a/toolkit/components/extensions/schemas/moz.build b/toolkit/components/webextensions/schemas/moz.build
index aac3a838c..aac3a838c 100644
--- a/toolkit/components/extensions/schemas/moz.build
+++ b/toolkit/components/webextensions/schemas/moz.build
diff --git a/toolkit/components/extensions/schemas/native_host_manifest.json b/toolkit/components/webextensions/schemas/native_host_manifest.json
index 4ad2ea7f1..4ad2ea7f1 100644
--- a/toolkit/components/extensions/schemas/native_host_manifest.json
+++ b/toolkit/components/webextensions/schemas/native_host_manifest.json
diff --git a/toolkit/components/extensions/schemas/notifications.json b/toolkit/components/webextensions/schemas/notifications.json
index 12878e8c8..12878e8c8 100644
--- a/toolkit/components/extensions/schemas/notifications.json
+++ b/toolkit/components/webextensions/schemas/notifications.json
diff --git a/toolkit/components/extensions/schemas/runtime.json b/toolkit/components/webextensions/schemas/runtime.json
index b3f12a768..575df7d27 100644
--- a/toolkit/components/extensions/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/extensions/schemas/storage.json b/toolkit/components/webextensions/schemas/storage.json
index a54a20942..a54a20942 100644
--- a/toolkit/components/extensions/schemas/storage.json
+++ b/toolkit/components/webextensions/schemas/storage.json
diff --git a/toolkit/components/extensions/schemas/test.json b/toolkit/components/webextensions/schemas/test.json
index 25a62a96b..25a62a96b 100644
--- a/toolkit/components/extensions/schemas/test.json
+++ b/toolkit/components/webextensions/schemas/test.json
diff --git a/toolkit/components/extensions/schemas/top_sites.json b/toolkit/components/webextensions/schemas/top_sites.json
index fbfbc4b62..fbfbc4b62 100644
--- a/toolkit/components/extensions/schemas/top_sites.json
+++ b/toolkit/components/webextensions/schemas/top_sites.json
diff --git a/toolkit/components/extensions/schemas/web_navigation.json b/toolkit/components/webextensions/schemas/web_navigation.json
index 1e13b181a..1e13b181a 100644
--- a/toolkit/components/extensions/schemas/web_navigation.json
+++ b/toolkit/components/webextensions/schemas/web_navigation.json
diff --git a/toolkit/components/extensions/schemas/web_request.json b/toolkit/components/webextensions/schemas/web_request.json
index 4035aea6e..4035aea6e 100644
--- a/toolkit/components/extensions/schemas/web_request.json
+++ b/toolkit/components/webextensions/schemas/web_request.json
diff --git a/toolkit/components/extensions/test/mochitest/.eslintrc.js b/toolkit/components/webextensions/test/mochitest/.eslintrc.js
index 53938410b..53938410b 100644
--- a/toolkit/components/extensions/test/mochitest/.eslintrc.js
+++ b/toolkit/components/webextensions/test/mochitest/.eslintrc.js
diff --git a/toolkit/components/extensions/test/mochitest/chrome.ini b/toolkit/components/webextensions/test/mochitest/chrome.ini
index 26585cad7..26585cad7 100644
--- a/toolkit/components/extensions/test/mochitest/chrome.ini
+++ b/toolkit/components/webextensions/test/mochitest/chrome.ini
diff --git a/toolkit/components/extensions/test/mochitest/chrome_head.js b/toolkit/components/webextensions/test/mochitest/chrome_head.js
index da2f53a02..da2f53a02 100644
--- a/toolkit/components/extensions/test/mochitest/chrome_head.js
+++ b/toolkit/components/webextensions/test/mochitest/chrome_head.js
diff --git a/toolkit/components/extensions/test/mochitest/file_WebNavigation_page1.html b/toolkit/components/webextensions/test/mochitest/file_WebNavigation_page1.html
index 663ebc611..663ebc611 100644
--- a/toolkit/components/extensions/test/mochitest/file_WebNavigation_page1.html
+++ b/toolkit/components/webextensions/test/mochitest/file_WebNavigation_page1.html
diff --git a/toolkit/components/extensions/test/mochitest/file_WebNavigation_page2.html b/toolkit/components/webextensions/test/mochitest/file_WebNavigation_page2.html
index cc1acc83d..cc1acc83d 100644
--- a/toolkit/components/extensions/test/mochitest/file_WebNavigation_page2.html
+++ b/toolkit/components/webextensions/test/mochitest/file_WebNavigation_page2.html
diff --git a/toolkit/components/extensions/test/mochitest/file_WebNavigation_page3.html b/toolkit/components/webextensions/test/mochitest/file_WebNavigation_page3.html
index a0a26a2e9..a0a26a2e9 100644
--- a/toolkit/components/extensions/test/mochitest/file_WebNavigation_page3.html
+++ b/toolkit/components/webextensions/test/mochitest/file_WebNavigation_page3.html
diff --git a/toolkit/components/extensions/test/mochitest/file_WebRequest_page3.html b/toolkit/components/webextensions/test/mochitest/file_WebRequest_page3.html
index 5807dd439..5807dd439 100644
--- a/toolkit/components/extensions/test/mochitest/file_WebRequest_page3.html
+++ b/toolkit/components/webextensions/test/mochitest/file_WebRequest_page3.html
diff --git a/toolkit/components/extensions/test/mochitest/file_csp.html b/toolkit/components/webextensions/test/mochitest/file_csp.html
index 206e44390..206e44390 100644
--- a/toolkit/components/extensions/test/mochitest/file_csp.html
+++ b/toolkit/components/webextensions/test/mochitest/file_csp.html
diff --git a/toolkit/components/extensions/test/mochitest/file_csp.html^headers^ b/toolkit/components/webextensions/test/mochitest/file_csp.html^headers^
index 4c6fa3c26..4c6fa3c26 100644
--- a/toolkit/components/extensions/test/mochitest/file_csp.html^headers^
+++ b/toolkit/components/webextensions/test/mochitest/file_csp.html^headers^
diff --git a/toolkit/components/extensions/test/mochitest/file_ext_test_api_injection.js b/toolkit/components/webextensions/test/mochitest/file_ext_test_api_injection.js
index 06dfae65e..06dfae65e 100644
--- a/toolkit/components/extensions/test/mochitest/file_ext_test_api_injection.js
+++ b/toolkit/components/webextensions/test/mochitest/file_ext_test_api_injection.js
diff --git a/toolkit/components/extensions/test/mochitest/file_image_bad.png b/toolkit/components/webextensions/test/mochitest/file_image_bad.png
index 4c3be5084..4c3be5084 100644
--- a/toolkit/components/extensions/test/mochitest/file_image_bad.png
+++ b/toolkit/components/webextensions/test/mochitest/file_image_bad.png
Binary files differ
diff --git a/toolkit/components/extensions/test/mochitest/file_image_good.png b/toolkit/components/webextensions/test/mochitest/file_image_good.png
index 769c63634..769c63634 100644
--- a/toolkit/components/extensions/test/mochitest/file_image_good.png
+++ b/toolkit/components/webextensions/test/mochitest/file_image_good.png
Binary files differ
diff --git a/toolkit/components/extensions/test/mochitest/file_image_redirect.png b/toolkit/components/webextensions/test/mochitest/file_image_redirect.png
index 4c3be5084..4c3be5084 100644
--- a/toolkit/components/extensions/test/mochitest/file_image_redirect.png
+++ b/toolkit/components/webextensions/test/mochitest/file_image_redirect.png
Binary files differ
diff --git a/toolkit/components/extensions/test/mochitest/file_mixed.html b/toolkit/components/webextensions/test/mochitest/file_mixed.html
index f3c7dda58..f3c7dda58 100644
--- a/toolkit/components/extensions/test/mochitest/file_mixed.html
+++ b/toolkit/components/webextensions/test/mochitest/file_mixed.html
diff --git a/toolkit/components/extensions/test/mochitest/file_permission_xhr.html b/toolkit/components/webextensions/test/mochitest/file_permission_xhr.html
index 22a55f90d..22a55f90d 100644
--- a/toolkit/components/extensions/test/mochitest/file_permission_xhr.html
+++ b/toolkit/components/webextensions/test/mochitest/file_permission_xhr.html
diff --git a/toolkit/components/extensions/test/mochitest/file_privilege_escalation.html b/toolkit/components/webextensions/test/mochitest/file_privilege_escalation.html
index 258f7058d..258f7058d 100644
--- a/toolkit/components/extensions/test/mochitest/file_privilege_escalation.html
+++ b/toolkit/components/webextensions/test/mochitest/file_privilege_escalation.html
diff --git a/toolkit/components/extensions/test/mochitest/file_sample.html b/toolkit/components/webextensions/test/mochitest/file_sample.html
index a20e49a1f..a20e49a1f 100644
--- a/toolkit/components/extensions/test/mochitest/file_sample.html
+++ b/toolkit/components/webextensions/test/mochitest/file_sample.html
diff --git a/toolkit/components/extensions/test/mochitest/file_script_bad.js b/toolkit/components/webextensions/test/mochitest/file_script_bad.js
index c425122c7..c425122c7 100644
--- a/toolkit/components/extensions/test/mochitest/file_script_bad.js
+++ b/toolkit/components/webextensions/test/mochitest/file_script_bad.js
diff --git a/toolkit/components/extensions/test/mochitest/file_script_good.js b/toolkit/components/webextensions/test/mochitest/file_script_good.js
index 1848edf68..1848edf68 100644
--- a/toolkit/components/extensions/test/mochitest/file_script_good.js
+++ b/toolkit/components/webextensions/test/mochitest/file_script_good.js
diff --git a/toolkit/components/extensions/test/mochitest/file_script_redirect.js b/toolkit/components/webextensions/test/mochitest/file_script_redirect.js
index c89a196c2..c89a196c2 100644
--- a/toolkit/components/extensions/test/mochitest/file_script_redirect.js
+++ b/toolkit/components/webextensions/test/mochitest/file_script_redirect.js
diff --git a/toolkit/components/extensions/test/mochitest/file_script_xhr.js b/toolkit/components/webextensions/test/mochitest/file_script_xhr.js
index 07f80eb2e..07f80eb2e 100644
--- a/toolkit/components/extensions/test/mochitest/file_script_xhr.js
+++ b/toolkit/components/webextensions/test/mochitest/file_script_xhr.js
diff --git a/toolkit/components/extensions/test/mochitest/file_style_bad.css b/toolkit/components/webextensions/test/mochitest/file_style_bad.css
index 8dbc8dc7a..8dbc8dc7a 100644
--- a/toolkit/components/extensions/test/mochitest/file_style_bad.css
+++ b/toolkit/components/webextensions/test/mochitest/file_style_bad.css
diff --git a/toolkit/components/extensions/test/mochitest/file_style_good.css b/toolkit/components/webextensions/test/mochitest/file_style_good.css
index 46f9774b5..46f9774b5 100644
--- a/toolkit/components/extensions/test/mochitest/file_style_good.css
+++ b/toolkit/components/webextensions/test/mochitest/file_style_good.css
diff --git a/toolkit/components/extensions/test/mochitest/file_style_redirect.css b/toolkit/components/webextensions/test/mochitest/file_style_redirect.css
index 8dbc8dc7a..8dbc8dc7a 100644
--- a/toolkit/components/extensions/test/mochitest/file_style_redirect.css
+++ b/toolkit/components/webextensions/test/mochitest/file_style_redirect.css
diff --git a/toolkit/components/extensions/test/mochitest/file_teardown_test.js b/toolkit/components/webextensions/test/mochitest/file_teardown_test.js
index 7246012ad..7246012ad 100644
--- a/toolkit/components/extensions/test/mochitest/file_teardown_test.js
+++ b/toolkit/components/webextensions/test/mochitest/file_teardown_test.js
diff --git a/toolkit/components/extensions/test/mochitest/file_webNavigation_clientRedirect.html b/toolkit/components/webextensions/test/mochitest/file_webNavigation_clientRedirect.html
index cba3043f7..cba3043f7 100644
--- a/toolkit/components/extensions/test/mochitest/file_webNavigation_clientRedirect.html
+++ b/toolkit/components/webextensions/test/mochitest/file_webNavigation_clientRedirect.html
diff --git a/toolkit/components/extensions/test/mochitest/file_webNavigation_clientRedirect_httpHeaders.html b/toolkit/components/webextensions/test/mochitest/file_webNavigation_clientRedirect_httpHeaders.html
index c5b436979..c5b436979 100644
--- a/toolkit/components/extensions/test/mochitest/file_webNavigation_clientRedirect_httpHeaders.html
+++ b/toolkit/components/webextensions/test/mochitest/file_webNavigation_clientRedirect_httpHeaders.html
diff --git a/toolkit/components/extensions/test/mochitest/file_webNavigation_clientRedirect_httpHeaders.html^headers^ b/toolkit/components/webextensions/test/mochitest/file_webNavigation_clientRedirect_httpHeaders.html^headers^
index 574a392a1..574a392a1 100644
--- a/toolkit/components/extensions/test/mochitest/file_webNavigation_clientRedirect_httpHeaders.html^headers^
+++ b/toolkit/components/webextensions/test/mochitest/file_webNavigation_clientRedirect_httpHeaders.html^headers^
diff --git a/toolkit/components/extensions/test/mochitest/file_webNavigation_frameClientRedirect.html b/toolkit/components/webextensions/test/mochitest/file_webNavigation_frameClientRedirect.html
index d360bcbb1..d360bcbb1 100644
--- a/toolkit/components/extensions/test/mochitest/file_webNavigation_frameClientRedirect.html
+++ b/toolkit/components/webextensions/test/mochitest/file_webNavigation_frameClientRedirect.html
diff --git a/toolkit/components/extensions/test/mochitest/file_webNavigation_frameRedirect.html b/toolkit/components/webextensions/test/mochitest/file_webNavigation_frameRedirect.html
index 06dbd4374..06dbd4374 100644
--- a/toolkit/components/extensions/test/mochitest/file_webNavigation_frameRedirect.html
+++ b/toolkit/components/webextensions/test/mochitest/file_webNavigation_frameRedirect.html
diff --git a/toolkit/components/extensions/test/mochitest/file_webNavigation_manualSubframe.html b/toolkit/components/webextensions/test/mochitest/file_webNavigation_manualSubframe.html
index 307990714..307990714 100644
--- a/toolkit/components/extensions/test/mochitest/file_webNavigation_manualSubframe.html
+++ b/toolkit/components/webextensions/test/mochitest/file_webNavigation_manualSubframe.html
diff --git a/toolkit/components/extensions/test/mochitest/file_webNavigation_manualSubframe_page1.html b/toolkit/components/webextensions/test/mochitest/file_webNavigation_manualSubframe_page1.html
index 55bb7aa6a..55bb7aa6a 100644
--- a/toolkit/components/extensions/test/mochitest/file_webNavigation_manualSubframe_page1.html
+++ b/toolkit/components/webextensions/test/mochitest/file_webNavigation_manualSubframe_page1.html
diff --git a/toolkit/components/extensions/test/mochitest/file_webNavigation_manualSubframe_page2.html b/toolkit/components/webextensions/test/mochitest/file_webNavigation_manualSubframe_page2.html
index 8f589f8bb..8f589f8bb 100644
--- a/toolkit/components/extensions/test/mochitest/file_webNavigation_manualSubframe_page2.html
+++ b/toolkit/components/webextensions/test/mochitest/file_webNavigation_manualSubframe_page2.html
diff --git a/toolkit/components/extensions/test/mochitest/file_with_about_blank.html b/toolkit/components/webextensions/test/mochitest/file_with_about_blank.html
index af51c2e52..af51c2e52 100644
--- a/toolkit/components/extensions/test/mochitest/file_with_about_blank.html
+++ b/toolkit/components/webextensions/test/mochitest/file_with_about_blank.html
diff --git a/toolkit/components/extensions/test/mochitest/head.js b/toolkit/components/webextensions/test/mochitest/head.js
index 1b1a29472..1b1a29472 100644
--- a/toolkit/components/extensions/test/mochitest/head.js
+++ b/toolkit/components/webextensions/test/mochitest/head.js
diff --git a/toolkit/components/extensions/test/mochitest/head_cookies.js b/toolkit/components/webextensions/test/mochitest/head_cookies.js
index 9f6966551..9f6966551 100644
--- a/toolkit/components/extensions/test/mochitest/head_cookies.js
+++ b/toolkit/components/webextensions/test/mochitest/head_cookies.js
diff --git a/toolkit/components/extensions/test/mochitest/head_webrequest.js b/toolkit/components/webextensions/test/mochitest/head_webrequest.js
index 96924e505..96924e505 100644
--- a/toolkit/components/extensions/test/mochitest/head_webrequest.js
+++ b/toolkit/components/webextensions/test/mochitest/head_webrequest.js
diff --git a/toolkit/components/extensions/test/mochitest/mochitest.ini b/toolkit/components/webextensions/test/mochitest/mochitest.ini
index 45586237e..1f61060ad 100644
--- a/toolkit/components/extensions/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/extensions/test/mochitest/redirection.sjs b/toolkit/components/webextensions/test/mochitest/redirection.sjs
index 370ecd213..370ecd213 100644
--- a/toolkit/components/extensions/test/mochitest/redirection.sjs
+++ b/toolkit/components/webextensions/test/mochitest/redirection.sjs
diff --git a/toolkit/components/extensions/test/mochitest/return_headers.sjs b/toolkit/components/webextensions/test/mochitest/return_headers.sjs
index 54e2e5fb4..54e2e5fb4 100644
--- a/toolkit/components/extensions/test/mochitest/return_headers.sjs
+++ b/toolkit/components/webextensions/test/mochitest/return_headers.sjs
diff --git a/toolkit/components/extensions/test/mochitest/test_chrome_ext_background_debug_global.html b/toolkit/components/webextensions/test/mochitest/test_chrome_ext_background_debug_global.html
index 0edf5ea86..0edf5ea86 100644
--- a/toolkit/components/extensions/test/mochitest/test_chrome_ext_background_debug_global.html
+++ b/toolkit/components/webextensions/test/mochitest/test_chrome_ext_background_debug_global.html
diff --git a/toolkit/components/extensions/test/mochitest/test_chrome_ext_background_page.html b/toolkit/components/webextensions/test/mochitest/test_chrome_ext_background_page.html
index 3c4774652..471c5339d 100644
--- a/toolkit/components/extensions/test/mochitest/test_chrome_ext_background_page.html
+++ b/toolkit/components/webextensions/test/mochitest/test_chrome_ext_background_page.html
@@ -66,14 +66,14 @@ add_task(function* testAlertNotShownInBackgroundWindow() {
let {require} = Cu.import("resource://devtools/shared/Loader.jsm", {});
require("devtools/client/framework/devtools-browser");
- let hudservice = require("devtools/client/webconsole/hudservice");
+ let {HUDService} = require("devtools/client/webconsole/hudservice");
// And then double check that we have an actual browser console.
- let haveConsole = !!hudservice.getBrowserConsole();
+ let haveConsole = !!HUDService.getBrowserConsole();
ok(haveConsole, "Expected browser console to be open");
if (haveConsole) {
- yield hudservice.toggleBrowserConsole();
+ yield HUDService.toggleBrowserConsole();
}
yield extension.unload();
diff --git a/toolkit/components/extensions/test/mochitest/test_chrome_ext_contentscript_unrecognizedprop_warning.html b/toolkit/components/webextensions/test/mochitest/test_chrome_ext_contentscript_unrecognizedprop_warning.html
index e08121a8f..e08121a8f 100644
--- a/toolkit/components/extensions/test/mochitest/test_chrome_ext_contentscript_unrecognizedprop_warning.html
+++ b/toolkit/components/webextensions/test/mochitest/test_chrome_ext_contentscript_unrecognizedprop_warning.html
diff --git a/toolkit/components/extensions/test/mochitest/test_chrome_ext_downloads_saveAs.html b/toolkit/components/webextensions/test/mochitest/test_chrome_ext_downloads_saveAs.html
index c1aaae035..c1aaae035 100644
--- a/toolkit/components/extensions/test/mochitest/test_chrome_ext_downloads_saveAs.html
+++ b/toolkit/components/webextensions/test/mochitest/test_chrome_ext_downloads_saveAs.html
diff --git a/toolkit/components/extensions/test/mochitest/test_chrome_ext_eventpage_warning.html b/toolkit/components/webextensions/test/mochitest/test_chrome_ext_eventpage_warning.html
index ecea8237e..ecea8237e 100644
--- a/toolkit/components/extensions/test/mochitest/test_chrome_ext_eventpage_warning.html
+++ b/toolkit/components/webextensions/test/mochitest/test_chrome_ext_eventpage_warning.html
diff --git a/toolkit/components/extensions/test/mochitest/test_chrome_ext_hybrid_addons.html b/toolkit/components/webextensions/test/mochitest/test_chrome_ext_hybrid_addons.html
index a74c551f0..a74c551f0 100644
--- a/toolkit/components/extensions/test/mochitest/test_chrome_ext_hybrid_addons.html
+++ b/toolkit/components/webextensions/test/mochitest/test_chrome_ext_hybrid_addons.html
diff --git a/toolkit/components/extensions/test/mochitest/test_chrome_ext_idle.html b/toolkit/components/webextensions/test/mochitest/test_chrome_ext_idle.html
index 3c3063e67..3c3063e67 100644
--- a/toolkit/components/extensions/test/mochitest/test_chrome_ext_idle.html
+++ b/toolkit/components/webextensions/test/mochitest/test_chrome_ext_idle.html
diff --git a/toolkit/components/extensions/test/mochitest/test_chrome_ext_shutdown_cleanup.html b/toolkit/components/webextensions/test/mochitest/test_chrome_ext_shutdown_cleanup.html
index e3098e6b1..e3098e6b1 100644
--- a/toolkit/components/extensions/test/mochitest/test_chrome_ext_shutdown_cleanup.html
+++ b/toolkit/components/webextensions/test/mochitest/test_chrome_ext_shutdown_cleanup.html
diff --git a/toolkit/components/extensions/test/mochitest/test_chrome_ext_storage_cleanup.html b/toolkit/components/webextensions/test/mochitest/test_chrome_ext_storage_cleanup.html
index 010769500..010769500 100644
--- a/toolkit/components/extensions/test/mochitest/test_chrome_ext_storage_cleanup.html
+++ b/toolkit/components/webextensions/test/mochitest/test_chrome_ext_storage_cleanup.html
diff --git a/toolkit/components/extensions/test/mochitest/test_chrome_ext_trustworthy_origin.html b/toolkit/components/webextensions/test/mochitest/test_chrome_ext_trustworthy_origin.html
index 573c08806..573c08806 100644
--- a/toolkit/components/extensions/test/mochitest/test_chrome_ext_trustworthy_origin.html
+++ b/toolkit/components/webextensions/test/mochitest/test_chrome_ext_trustworthy_origin.html
diff --git a/toolkit/components/extensions/test/mochitest/test_chrome_ext_webnavigation_resolved_urls.html b/toolkit/components/webextensions/test/mochitest/test_chrome_ext_webnavigation_resolved_urls.html
index 768eb31fd..768eb31fd 100644
--- a/toolkit/components/extensions/test/mochitest/test_chrome_ext_webnavigation_resolved_urls.html
+++ b/toolkit/components/webextensions/test/mochitest/test_chrome_ext_webnavigation_resolved_urls.html
diff --git a/toolkit/components/extensions/test/mochitest/test_chrome_ext_webrequest_background_events.html b/toolkit/components/webextensions/test/mochitest/test_chrome_ext_webrequest_background_events.html
index a13c4d475..a13c4d475 100644
--- a/toolkit/components/extensions/test/mochitest/test_chrome_ext_webrequest_background_events.html
+++ b/toolkit/components/webextensions/test/mochitest/test_chrome_ext_webrequest_background_events.html
diff --git a/toolkit/components/extensions/test/mochitest/test_chrome_native_messaging_paths.html b/toolkit/components/webextensions/test/mochitest/test_chrome_native_messaging_paths.html
index 29a148063..29a148063 100644
--- a/toolkit/components/extensions/test/mochitest/test_chrome_native_messaging_paths.html
+++ b/toolkit/components/webextensions/test/mochitest/test_chrome_native_messaging_paths.html
diff --git a/toolkit/components/extensions/test/mochitest/test_clipboard.html b/toolkit/components/webextensions/test/mochitest/test_clipboard.html
index 900ee5f10..900ee5f10 100644
--- a/toolkit/components/extensions/test/mochitest/test_clipboard.html
+++ b/toolkit/components/webextensions/test/mochitest/test_clipboard.html
diff --git a/toolkit/components/extensions/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/extensions/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/extensions/test/mochitest/test_ext_background_api_injection.html b/toolkit/components/webextensions/test/mochitest/test_ext_background_api_injection.html
index f43a59f81..f43a59f81 100644
--- a/toolkit/components/extensions/test/mochitest/test_ext_background_api_injection.html
+++ b/toolkit/components/webextensions/test/mochitest/test_ext_background_api_injection.html
diff --git a/toolkit/components/extensions/test/mochitest/test_ext_background_canvas.html b/toolkit/components/webextensions/test/mochitest/test_ext_background_canvas.html
index bff7190cb..bff7190cb 100644
--- a/toolkit/components/extensions/test/mochitest/test_ext_background_canvas.html
+++ b/toolkit/components/webextensions/test/mochitest/test_ext_background_canvas.html
diff --git a/toolkit/components/extensions/test/mochitest/test_ext_background_generated_url.html b/toolkit/components/webextensions/test/mochitest/test_ext_background_generated_url.html
index f4fcf3d34..f4fcf3d34 100644
--- a/toolkit/components/extensions/test/mochitest/test_ext_background_generated_url.html
+++ b/toolkit/components/webextensions/test/mochitest/test_ext_background_generated_url.html
diff --git a/toolkit/components/extensions/test/mochitest/test_ext_background_teardown.html b/toolkit/components/webextensions/test/mochitest/test_ext_background_teardown.html
index bb6b2e970..bb6b2e970 100644
--- a/toolkit/components/extensions/test/mochitest/test_ext_background_teardown.html
+++ b/toolkit/components/webextensions/test/mochitest/test_ext_background_teardown.html
diff --git a/toolkit/components/extensions/test/mochitest/test_ext_content_security_policy.html b/toolkit/components/webextensions/test/mochitest/test_ext_content_security_policy.html
index a36f29563..a36f29563 100644
--- a/toolkit/components/extensions/test/mochitest/test_ext_content_security_policy.html
+++ b/toolkit/components/webextensions/test/mochitest/test_ext_content_security_policy.html
diff --git a/toolkit/components/extensions/test/mochitest/test_ext_contentscript.html b/toolkit/components/webextensions/test/mochitest/test_ext_contentscript.html
index 39f1bfabd..39f1bfabd 100644
--- a/toolkit/components/extensions/test/mochitest/test_ext_contentscript.html
+++ b/toolkit/components/webextensions/test/mochitest/test_ext_contentscript.html
diff --git a/toolkit/components/extensions/test/mochitest/test_ext_contentscript_about_blank.html b/toolkit/components/webextensions/test/mochitest/test_ext_contentscript_about_blank.html
index 3766678e7..3766678e7 100644
--- a/toolkit/components/extensions/test/mochitest/test_ext_contentscript_about_blank.html
+++ b/toolkit/components/webextensions/test/mochitest/test_ext_contentscript_about_blank.html
diff --git a/toolkit/components/extensions/test/mochitest/test_ext_contentscript_api_injection.html b/toolkit/components/webextensions/test/mochitest/test_ext_contentscript_api_injection.html
index abf3d349f..abf3d349f 100644
--- a/toolkit/components/extensions/test/mochitest/test_ext_contentscript_api_injection.html
+++ b/toolkit/components/webextensions/test/mochitest/test_ext_contentscript_api_injection.html
diff --git a/toolkit/components/extensions/test/mochitest/test_ext_contentscript_async_loading.html b/toolkit/components/webextensions/test/mochitest/test_ext_contentscript_async_loading.html
index d78f7ce02..d78f7ce02 100644
--- a/toolkit/components/extensions/test/mochitest/test_ext_contentscript_async_loading.html
+++ b/toolkit/components/webextensions/test/mochitest/test_ext_contentscript_async_loading.html
diff --git a/toolkit/components/extensions/test/mochitest/test_ext_contentscript_context.html b/toolkit/components/webextensions/test/mochitest/test_ext_contentscript_context.html
index 97b1645dd..97b1645dd 100644
--- a/toolkit/components/extensions/test/mochitest/test_ext_contentscript_context.html
+++ b/toolkit/components/webextensions/test/mochitest/test_ext_contentscript_context.html
diff --git a/toolkit/components/extensions/test/mochitest/test_ext_contentscript_create_iframe.html b/toolkit/components/webextensions/test/mochitest/test_ext_contentscript_create_iframe.html
index 8aac3e213..8aac3e213 100644
--- a/toolkit/components/extensions/test/mochitest/test_ext_contentscript_create_iframe.html
+++ b/toolkit/components/webextensions/test/mochitest/test_ext_contentscript_create_iframe.html
diff --git a/toolkit/components/extensions/test/mochitest/test_ext_contentscript_css.html b/toolkit/components/webextensions/test/mochitest/test_ext_contentscript_css.html
index 5630a1d68..5630a1d68 100644
--- a/toolkit/components/extensions/test/mochitest/test_ext_contentscript_css.html
+++ b/toolkit/components/webextensions/test/mochitest/test_ext_contentscript_css.html
diff --git a/toolkit/components/extensions/test/mochitest/test_ext_contentscript_devtools_metadata.html b/toolkit/components/webextensions/test/mochitest/test_ext_contentscript_devtools_metadata.html
index 137a3cda4..137a3cda4 100644
--- a/toolkit/components/extensions/test/mochitest/test_ext_contentscript_devtools_metadata.html
+++ b/toolkit/components/webextensions/test/mochitest/test_ext_contentscript_devtools_metadata.html
diff --git a/toolkit/components/extensions/test/mochitest/test_ext_contentscript_exporthelpers.html b/toolkit/components/webextensions/test/mochitest/test_ext_contentscript_exporthelpers.html
index f3414901d..f3414901d 100644
--- a/toolkit/components/extensions/test/mochitest/test_ext_contentscript_exporthelpers.html
+++ b/toolkit/components/webextensions/test/mochitest/test_ext_contentscript_exporthelpers.html
diff --git a/toolkit/components/extensions/test/mochitest/test_ext_contentscript_incognito.html b/toolkit/components/webextensions/test/mochitest/test_ext_contentscript_incognito.html
index a2f38dce6..a2f38dce6 100644
--- a/toolkit/components/extensions/test/mochitest/test_ext_contentscript_incognito.html
+++ b/toolkit/components/webextensions/test/mochitest/test_ext_contentscript_incognito.html
diff --git a/toolkit/components/extensions/test/mochitest/test_ext_contentscript_permission.html b/toolkit/components/webextensions/test/mochitest/test_ext_contentscript_permission.html
index eaf815092..eaf815092 100644
--- a/toolkit/components/extensions/test/mochitest/test_ext_contentscript_permission.html
+++ b/toolkit/components/webextensions/test/mochitest/test_ext_contentscript_permission.html
diff --git a/toolkit/components/extensions/test/mochitest/test_ext_contentscript_teardown.html b/toolkit/components/webextensions/test/mochitest/test_ext_contentscript_teardown.html
index 33a8c4ccc..33a8c4ccc 100644
--- a/toolkit/components/extensions/test/mochitest/test_ext_contentscript_teardown.html
+++ b/toolkit/components/webextensions/test/mochitest/test_ext_contentscript_teardown.html
diff --git a/toolkit/components/extensions/test/mochitest/test_ext_cookies.html b/toolkit/components/webextensions/test/mochitest/test_ext_cookies.html
index d414a4e46..d414a4e46 100644
--- a/toolkit/components/extensions/test/mochitest/test_ext_cookies.html
+++ b/toolkit/components/webextensions/test/mochitest/test_ext_cookies.html
diff --git a/toolkit/components/extensions/test/mochitest/test_ext_cookies_containers.html b/toolkit/components/webextensions/test/mochitest/test_ext_cookies_containers.html
index bc4994eec..bc4994eec 100644
--- a/toolkit/components/extensions/test/mochitest/test_ext_cookies_containers.html
+++ b/toolkit/components/webextensions/test/mochitest/test_ext_cookies_containers.html
diff --git a/toolkit/components/extensions/test/mochitest/test_ext_cookies_expiry.html b/toolkit/components/webextensions/test/mochitest/test_ext_cookies_expiry.html
index 3927d9e94..3927d9e94 100644
--- a/toolkit/components/extensions/test/mochitest/test_ext_cookies_expiry.html
+++ b/toolkit/components/webextensions/test/mochitest/test_ext_cookies_expiry.html
diff --git a/toolkit/components/extensions/test/mochitest/test_ext_cookies_permissions_bad.html b/toolkit/components/webextensions/test/mochitest/test_ext_cookies_permissions_bad.html
index 15a62855a..15a62855a 100644
--- a/toolkit/components/extensions/test/mochitest/test_ext_cookies_permissions_bad.html
+++ b/toolkit/components/webextensions/test/mochitest/test_ext_cookies_permissions_bad.html
diff --git a/toolkit/components/extensions/test/mochitest/test_ext_cookies_permissions_good.html b/toolkit/components/webextensions/test/mochitest/test_ext_cookies_permissions_good.html
index 31e83188c..31e83188c 100644
--- a/toolkit/components/extensions/test/mochitest/test_ext_cookies_permissions_good.html
+++ b/toolkit/components/webextensions/test/mochitest/test_ext_cookies_permissions_good.html
diff --git a/toolkit/components/extensions/test/mochitest/test_ext_exclude_include_globs.html b/toolkit/components/webextensions/test/mochitest/test_ext_exclude_include_globs.html
index 640522b40..640522b40 100644
--- a/toolkit/components/extensions/test/mochitest/test_ext_exclude_include_globs.html
+++ b/toolkit/components/webextensions/test/mochitest/test_ext_exclude_include_globs.html
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/extensions/test/mochitest/test_ext_generate.html b/toolkit/components/webextensions/test/mochitest/test_ext_generate.html
index cfafcbad9..cfafcbad9 100644
--- a/toolkit/components/extensions/test/mochitest/test_ext_generate.html
+++ b/toolkit/components/webextensions/test/mochitest/test_ext_generate.html
diff --git a/toolkit/components/extensions/test/mochitest/test_ext_geturl.html b/toolkit/components/webextensions/test/mochitest/test_ext_geturl.html
index 6e39c2f5d..6e39c2f5d 100644
--- a/toolkit/components/extensions/test/mochitest/test_ext_geturl.html
+++ b/toolkit/components/webextensions/test/mochitest/test_ext_geturl.html
diff --git a/toolkit/components/extensions/test/mochitest/test_ext_i18n.html b/toolkit/components/webextensions/test/mochitest/test_ext_i18n.html
index 1f7330bbb..1f7330bbb 100644
--- a/toolkit/components/extensions/test/mochitest/test_ext_i18n.html
+++ b/toolkit/components/webextensions/test/mochitest/test_ext_i18n.html
diff --git a/toolkit/components/extensions/test/mochitest/test_ext_i18n_css.html b/toolkit/components/webextensions/test/mochitest/test_ext_i18n_css.html
index 7c6a8eeaa..7c6a8eeaa 100644
--- a/toolkit/components/extensions/test/mochitest/test_ext_i18n_css.html
+++ b/toolkit/components/webextensions/test/mochitest/test_ext_i18n_css.html
diff --git a/toolkit/components/extensions/test/mochitest/test_ext_inIncognitoContext_window.html b/toolkit/components/webextensions/test/mochitest/test_ext_inIncognitoContext_window.html
index 675cbb298..675cbb298 100644
--- a/toolkit/components/extensions/test/mochitest/test_ext_inIncognitoContext_window.html
+++ b/toolkit/components/webextensions/test/mochitest/test_ext_inIncognitoContext_window.html
diff --git a/toolkit/components/extensions/test/mochitest/test_ext_jsversion.html b/toolkit/components/webextensions/test/mochitest/test_ext_jsversion.html
index da0c355e0..da0c355e0 100644
--- a/toolkit/components/extensions/test/mochitest/test_ext_jsversion.html
+++ b/toolkit/components/webextensions/test/mochitest/test_ext_jsversion.html
diff --git a/toolkit/components/extensions/test/mochitest/test_ext_listener_proxies.html b/toolkit/components/webextensions/test/mochitest/test_ext_listener_proxies.html
index ca8db873e..ca8db873e 100644
--- a/toolkit/components/extensions/test/mochitest/test_ext_listener_proxies.html
+++ b/toolkit/components/webextensions/test/mochitest/test_ext_listener_proxies.html
diff --git a/toolkit/components/extensions/test/mochitest/test_ext_notifications.html b/toolkit/components/webextensions/test/mochitest/test_ext_notifications.html
index d1b798cf9..d1b798cf9 100644
--- a/toolkit/components/extensions/test/mochitest/test_ext_notifications.html
+++ b/toolkit/components/webextensions/test/mochitest/test_ext_notifications.html
diff --git a/toolkit/components/extensions/test/mochitest/test_ext_permission_xhr.html b/toolkit/components/webextensions/test/mochitest/test_ext_permission_xhr.html
index 07967d5d0..07967d5d0 100644
--- a/toolkit/components/extensions/test/mochitest/test_ext_permission_xhr.html
+++ b/toolkit/components/webextensions/test/mochitest/test_ext_permission_xhr.html
diff --git a/toolkit/components/extensions/test/mochitest/test_ext_runtime_connect.html b/toolkit/components/webextensions/test/mochitest/test_ext_runtime_connect.html
index 60351eaee..60351eaee 100644
--- a/toolkit/components/extensions/test/mochitest/test_ext_runtime_connect.html
+++ b/toolkit/components/webextensions/test/mochitest/test_ext_runtime_connect.html
diff --git a/toolkit/components/extensions/test/mochitest/test_ext_runtime_connect2.html b/toolkit/components/webextensions/test/mochitest/test_ext_runtime_connect2.html
index dce12b21b..dce12b21b 100644
--- a/toolkit/components/extensions/test/mochitest/test_ext_runtime_connect2.html
+++ b/toolkit/components/webextensions/test/mochitest/test_ext_runtime_connect2.html
diff --git a/toolkit/components/extensions/test/mochitest/test_ext_runtime_connect_twoway.html b/toolkit/components/webextensions/test/mochitest/test_ext_runtime_connect_twoway.html
index e84134eff..e84134eff 100644
--- a/toolkit/components/extensions/test/mochitest/test_ext_runtime_connect_twoway.html
+++ b/toolkit/components/webextensions/test/mochitest/test_ext_runtime_connect_twoway.html
diff --git a/toolkit/components/extensions/test/mochitest/test_ext_runtime_disconnect.html b/toolkit/components/webextensions/test/mochitest/test_ext_runtime_disconnect.html
index 5764d0a3c..5764d0a3c 100644
--- a/toolkit/components/extensions/test/mochitest/test_ext_runtime_disconnect.html
+++ b/toolkit/components/webextensions/test/mochitest/test_ext_runtime_disconnect.html
diff --git a/toolkit/components/extensions/test/mochitest/test_ext_runtime_id.html b/toolkit/components/webextensions/test/mochitest/test_ext_runtime_id.html
index 4cdefda41..4cdefda41 100644
--- a/toolkit/components/extensions/test/mochitest/test_ext_runtime_id.html
+++ b/toolkit/components/webextensions/test/mochitest/test_ext_runtime_id.html
diff --git a/toolkit/components/extensions/test/mochitest/test_ext_sandbox_var.html b/toolkit/components/webextensions/test/mochitest/test_ext_sandbox_var.html
index 426a71ac6..426a71ac6 100644
--- a/toolkit/components/extensions/test/mochitest/test_ext_sandbox_var.html
+++ b/toolkit/components/webextensions/test/mochitest/test_ext_sandbox_var.html
diff --git a/toolkit/components/extensions/test/mochitest/test_ext_schema.html b/toolkit/components/webextensions/test/mochitest/test_ext_schema.html
index 8a0e11c56..8a0e11c56 100644
--- a/toolkit/components/extensions/test/mochitest/test_ext_schema.html
+++ b/toolkit/components/webextensions/test/mochitest/test_ext_schema.html
diff --git a/toolkit/components/extensions/test/mochitest/test_ext_sendmessage_doublereply.html b/toolkit/components/webextensions/test/mochitest/test_ext_sendmessage_doublereply.html
index a3ef37cad..a3ef37cad 100644
--- a/toolkit/components/extensions/test/mochitest/test_ext_sendmessage_doublereply.html
+++ b/toolkit/components/webextensions/test/mochitest/test_ext_sendmessage_doublereply.html
diff --git a/toolkit/components/extensions/test/mochitest/test_ext_sendmessage_no_receiver.html b/toolkit/components/webextensions/test/mochitest/test_ext_sendmessage_no_receiver.html
index 96af6558e..96af6558e 100644
--- a/toolkit/components/extensions/test/mochitest/test_ext_sendmessage_no_receiver.html
+++ b/toolkit/components/webextensions/test/mochitest/test_ext_sendmessage_no_receiver.html
diff --git a/toolkit/components/extensions/test/mochitest/test_ext_sendmessage_reply.html b/toolkit/components/webextensions/test/mochitest/test_ext_sendmessage_reply.html
index a4ac708b2..a4ac708b2 100644
--- a/toolkit/components/extensions/test/mochitest/test_ext_sendmessage_reply.html
+++ b/toolkit/components/webextensions/test/mochitest/test_ext_sendmessage_reply.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
new file mode 100644
index 000000000..5c350be2f
--- /dev/null
+++ b/toolkit/components/webextensions/test/mochitest/test_ext_sendmessage_reply2.html
@@ -0,0 +1,181 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>WebExtension test</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(token, id, otherId) {
+ browser.tabs.create({url: "tab.html"});
+
+ browser.runtime.onMessage.addListener((msg, sender, sendReply) => {
+ browser.test.assertEq(id, sender.id, `${id}: Got expected sender ID`);
+
+ 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`);
+ }),
+
+ 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.sendMessage("content-script-done");
+ });
+}
+
+function tabScript(token, id, otherId) {
+ let gotTabMessage = false;
+ browser.runtime.onMessage.addListener((msg, sender, sendReply) => {
+ 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;
+ }
+ });
+
+ 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(id, otherId) {
+ let token = Math.random();
+
+ let args = `${token}, ${JSON.stringify(id)}, ${JSON.stringify(otherId)}`;
+
+ let extensionData = {
+ background: `(${backgroundScript})(${args})`,
+ manifest: {
+ "applications": {"gecko": {id}},
+
+ "permissions": ["tabs"],
+
+
+ "content_scripts": [{
+ "matches": ["http://mochi.test/*/file_sample.html"],
+ "js": ["content_script.js"],
+ "run_at": "document_start",
+ }],
+ },
+
+ files: {
+ "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() {
+ 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 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();
+});
+</script>
+
+</body>
+</html>
diff --git a/toolkit/components/extensions/test/mochitest/test_ext_storage_content.html b/toolkit/components/webextensions/test/mochitest/test_ext_storage_content.html
index 09a33814a..09a33814a 100644
--- a/toolkit/components/extensions/test/mochitest/test_ext_storage_content.html
+++ b/toolkit/components/webextensions/test/mochitest/test_ext_storage_content.html
diff --git a/toolkit/components/extensions/test/mochitest/test_ext_storage_tab.html b/toolkit/components/webextensions/test/mochitest/test_ext_storage_tab.html
index 32d8e6af0..32d8e6af0 100644
--- a/toolkit/components/extensions/test/mochitest/test_ext_storage_tab.html
+++ b/toolkit/components/webextensions/test/mochitest/test_ext_storage_tab.html
diff --git a/toolkit/components/extensions/test/mochitest/test_ext_subframes_privileges.html b/toolkit/components/webextensions/test/mochitest/test_ext_subframes_privileges.html
index 1f3a9a3c9..1f3a9a3c9 100644
--- a/toolkit/components/extensions/test/mochitest/test_ext_subframes_privileges.html
+++ b/toolkit/components/webextensions/test/mochitest/test_ext_subframes_privileges.html
diff --git a/toolkit/components/extensions/test/mochitest/test_ext_tab_teardown.html b/toolkit/components/webextensions/test/mochitest/test_ext_tab_teardown.html
index dc351e48a..dc351e48a 100644
--- a/toolkit/components/extensions/test/mochitest/test_ext_tab_teardown.html
+++ b/toolkit/components/webextensions/test/mochitest/test_ext_tab_teardown.html
diff --git a/toolkit/components/extensions/test/mochitest/test_ext_test.html b/toolkit/components/webextensions/test/mochitest/test_ext_test.html
index fef31e0e2..fef31e0e2 100644
--- a/toolkit/components/extensions/test/mochitest/test_ext_test.html
+++ b/toolkit/components/webextensions/test/mochitest/test_ext_test.html
diff --git a/toolkit/components/extensions/test/mochitest/test_ext_unload_frame.html b/toolkit/components/webextensions/test/mochitest/test_ext_unload_frame.html
index 5572de281..5572de281 100644
--- a/toolkit/components/extensions/test/mochitest/test_ext_unload_frame.html
+++ b/toolkit/components/webextensions/test/mochitest/test_ext_unload_frame.html
diff --git a/toolkit/components/extensions/test/mochitest/test_ext_web_accessible_resources.html b/toolkit/components/webextensions/test/mochitest/test_ext_web_accessible_resources.html
index fa3228739..fa3228739 100644
--- a/toolkit/components/extensions/test/mochitest/test_ext_web_accessible_resources.html
+++ b/toolkit/components/webextensions/test/mochitest/test_ext_web_accessible_resources.html
diff --git a/toolkit/components/extensions/test/mochitest/test_ext_webnavigation.html b/toolkit/components/webextensions/test/mochitest/test_ext_webnavigation.html
index 2287fd9b1..2287fd9b1 100644
--- a/toolkit/components/extensions/test/mochitest/test_ext_webnavigation.html
+++ b/toolkit/components/webextensions/test/mochitest/test_ext_webnavigation.html
diff --git a/toolkit/components/extensions/test/mochitest/test_ext_webnavigation_filters.html b/toolkit/components/webextensions/test/mochitest/test_ext_webnavigation_filters.html
index a0de5e9e5..a0de5e9e5 100644
--- a/toolkit/components/extensions/test/mochitest/test_ext_webnavigation_filters.html
+++ b/toolkit/components/webextensions/test/mochitest/test_ext_webnavigation_filters.html
diff --git a/toolkit/components/extensions/test/mochitest/test_ext_webrequest_background_events.html b/toolkit/components/webextensions/test/mochitest/test_ext_webrequest_background_events.html
index 78efeab35..78efeab35 100644
--- a/toolkit/components/extensions/test/mochitest/test_ext_webrequest_background_events.html
+++ b/toolkit/components/webextensions/test/mochitest/test_ext_webrequest_background_events.html
diff --git a/toolkit/components/extensions/test/mochitest/test_ext_webrequest_basic.html b/toolkit/components/webextensions/test/mochitest/test_ext_webrequest_basic.html
index ef77fee3b..ef77fee3b 100644
--- a/toolkit/components/extensions/test/mochitest/test_ext_webrequest_basic.html
+++ b/toolkit/components/webextensions/test/mochitest/test_ext_webrequest_basic.html
diff --git a/toolkit/components/extensions/test/mochitest/test_ext_webrequest_suspend.html b/toolkit/components/webextensions/test/mochitest/test_ext_webrequest_suspend.html
index c8423ec7c..c8423ec7c 100644
--- a/toolkit/components/extensions/test/mochitest/test_ext_webrequest_suspend.html
+++ b/toolkit/components/webextensions/test/mochitest/test_ext_webrequest_suspend.html
diff --git a/toolkit/components/extensions/test/mochitest/test_ext_webrequest_upload.html b/toolkit/components/webextensions/test/mochitest/test_ext_webrequest_upload.html
index 998ab9800..998ab9800 100644
--- a/toolkit/components/extensions/test/mochitest/test_ext_webrequest_upload.html
+++ b/toolkit/components/webextensions/test/mochitest/test_ext_webrequest_upload.html
diff --git a/toolkit/components/extensions/test/mochitest/test_ext_window_postMessage.html b/toolkit/components/webextensions/test/mochitest/test_ext_window_postMessage.html
index 7d49d55ba..7d49d55ba 100644
--- a/toolkit/components/extensions/test/mochitest/test_ext_window_postMessage.html
+++ b/toolkit/components/webextensions/test/mochitest/test_ext_window_postMessage.html
diff --git a/toolkit/components/extensions/test/mochitest/test_ext_xhr_capabilities.html b/toolkit/components/webextensions/test/mochitest/test_ext_xhr_capabilities.html
index 1afdadb9f..1afdadb9f 100644
--- a/toolkit/components/extensions/test/mochitest/test_ext_xhr_capabilities.html
+++ b/toolkit/components/webextensions/test/mochitest/test_ext_xhr_capabilities.html
diff --git a/toolkit/components/extensions/test/mochitest/webrequest_chromeworker.js b/toolkit/components/webextensions/test/mochitest/webrequest_chromeworker.js
index ccfb2ac1f..ccfb2ac1f 100644
--- a/toolkit/components/extensions/test/mochitest/webrequest_chromeworker.js
+++ b/toolkit/components/webextensions/test/mochitest/webrequest_chromeworker.js
diff --git a/toolkit/components/extensions/test/mochitest/webrequest_test.jsm b/toolkit/components/webextensions/test/mochitest/webrequest_test.jsm
index bfb148301..bfb148301 100644
--- a/toolkit/components/extensions/test/mochitest/webrequest_test.jsm
+++ b/toolkit/components/webextensions/test/mochitest/webrequest_test.jsm
diff --git a/toolkit/components/extensions/test/mochitest/webrequest_worker.js b/toolkit/components/webextensions/test/mochitest/webrequest_worker.js
index dcffd0857..dcffd0857 100644
--- a/toolkit/components/extensions/test/mochitest/webrequest_worker.js
+++ b/toolkit/components/webextensions/test/mochitest/webrequest_worker.js
diff --git a/toolkit/components/extensions/test/xpcshell/.eslintrc.js b/toolkit/components/webextensions/test/xpcshell/.eslintrc.js
index 3758537ef..3758537ef 100644
--- a/toolkit/components/extensions/test/xpcshell/.eslintrc.js
+++ b/toolkit/components/webextensions/test/xpcshell/.eslintrc.js
diff --git a/toolkit/components/extensions/test/xpcshell/data/file_download.html b/toolkit/components/webextensions/test/xpcshell/data/file_download.html
index d970c6325..d970c6325 100644
--- a/toolkit/components/extensions/test/xpcshell/data/file_download.html
+++ b/toolkit/components/webextensions/test/xpcshell/data/file_download.html
diff --git a/toolkit/components/extensions/test/xpcshell/data/file_download.txt b/toolkit/components/webextensions/test/xpcshell/data/file_download.txt
index 6293c7af7..6293c7af7 100644
--- a/toolkit/components/extensions/test/xpcshell/data/file_download.txt
+++ b/toolkit/components/webextensions/test/xpcshell/data/file_download.txt
diff --git a/toolkit/components/extensions/test/xpcshell/head.js b/toolkit/components/webextensions/test/xpcshell/head.js
index 9e22be6da..9e22be6da 100644
--- a/toolkit/components/extensions/test/xpcshell/head.js
+++ b/toolkit/components/webextensions/test/xpcshell/head.js
diff --git a/toolkit/components/extensions/test/xpcshell/head_native_messaging.js b/toolkit/components/webextensions/test/xpcshell/head_native_messaging.js
index f7c619b76..f7c619b76 100644
--- a/toolkit/components/extensions/test/xpcshell/head_native_messaging.js
+++ b/toolkit/components/webextensions/test/xpcshell/head_native_messaging.js
diff --git a/toolkit/components/extensions/test/xpcshell/head_sync.js b/toolkit/components/webextensions/test/xpcshell/head_sync.js
index 9b66b78e7..9b66b78e7 100644
--- a/toolkit/components/extensions/test/xpcshell/head_sync.js
+++ b/toolkit/components/webextensions/test/xpcshell/head_sync.js
diff --git a/toolkit/components/extensions/test/xpcshell/native_messaging.ini b/toolkit/components/webextensions/test/xpcshell/native_messaging.ini
index d0e1da163..d0e1da163 100644
--- a/toolkit/components/extensions/test/xpcshell/native_messaging.ini
+++ b/toolkit/components/webextensions/test/xpcshell/native_messaging.ini
diff --git a/toolkit/components/extensions/test/xpcshell/test_csp_custom_policies.js b/toolkit/components/webextensions/test/xpcshell/test_csp_custom_policies.js
index b6213baac..b6213baac 100644
--- a/toolkit/components/extensions/test/xpcshell/test_csp_custom_policies.js
+++ b/toolkit/components/webextensions/test/xpcshell/test_csp_custom_policies.js
diff --git a/toolkit/components/extensions/test/xpcshell/test_csp_validator.js b/toolkit/components/webextensions/test/xpcshell/test_csp_validator.js
index 59a7322bc..59a7322bc 100644
--- a/toolkit/components/extensions/test/xpcshell/test_csp_validator.js
+++ b/toolkit/components/webextensions/test/xpcshell/test_csp_validator.js
diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_alarms.js b/toolkit/components/webextensions/test/xpcshell/test_ext_alarms.js
index 936c984c6..936c984c6 100644
--- a/toolkit/components/extensions/test/xpcshell/test_ext_alarms.js
+++ b/toolkit/components/webextensions/test/xpcshell/test_ext_alarms.js
diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_alarms_does_not_fire.js b/toolkit/components/webextensions/test/xpcshell/test_ext_alarms_does_not_fire.js
index 11407b108..11407b108 100644
--- a/toolkit/components/extensions/test/xpcshell/test_ext_alarms_does_not_fire.js
+++ b/toolkit/components/webextensions/test/xpcshell/test_ext_alarms_does_not_fire.js
diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_alarms_periodic.js b/toolkit/components/webextensions/test/xpcshell/test_ext_alarms_periodic.js
index 6bcdf4e33..6bcdf4e33 100644
--- a/toolkit/components/extensions/test/xpcshell/test_ext_alarms_periodic.js
+++ b/toolkit/components/webextensions/test/xpcshell/test_ext_alarms_periodic.js
diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_alarms_replaces.js b/toolkit/components/webextensions/test/xpcshell/test_ext_alarms_replaces.js
index 96f61acb5..96f61acb5 100644
--- a/toolkit/components/extensions/test/xpcshell/test_ext_alarms_replaces.js
+++ b/toolkit/components/webextensions/test/xpcshell/test_ext_alarms_replaces.js
diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_api_permissions.js b/toolkit/components/webextensions/test/xpcshell/test_ext_api_permissions.js
index d653d0e7a..d653d0e7a 100644
--- a/toolkit/components/extensions/test/xpcshell/test_ext_api_permissions.js
+++ b/toolkit/components/webextensions/test/xpcshell/test_ext_api_permissions.js
diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_apimanager.js b/toolkit/components/webextensions/test/xpcshell/test_ext_apimanager.js
index 3f6672a11..3f6672a11 100644
--- a/toolkit/components/extensions/test/xpcshell/test_ext_apimanager.js
+++ b/toolkit/components/webextensions/test/xpcshell/test_ext_apimanager.js
diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_background_generated_load_events.js b/toolkit/components/webextensions/test/xpcshell/test_ext_background_generated_load_events.js
index 26282fcb9..26282fcb9 100644
--- a/toolkit/components/extensions/test/xpcshell/test_ext_background_generated_load_events.js
+++ b/toolkit/components/webextensions/test/xpcshell/test_ext_background_generated_load_events.js
diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_background_generated_reload.js b/toolkit/components/webextensions/test/xpcshell/test_ext_background_generated_reload.js
index 4bf59b798..4bf59b798 100644
--- a/toolkit/components/extensions/test/xpcshell/test_ext_background_generated_reload.js
+++ b/toolkit/components/webextensions/test/xpcshell/test_ext_background_generated_reload.js
diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_background_global_history.js b/toolkit/components/webextensions/test/xpcshell/test_ext_background_global_history.js
index 092a9f5b3..092a9f5b3 100644
--- a/toolkit/components/extensions/test/xpcshell/test_ext_background_global_history.js
+++ b/toolkit/components/webextensions/test/xpcshell/test_ext_background_global_history.js
diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_background_private_browsing.js b/toolkit/components/webextensions/test/xpcshell/test_ext_background_private_browsing.js
index 8e8b5e0b0..8e8b5e0b0 100644
--- a/toolkit/components/extensions/test/xpcshell/test_ext_background_private_browsing.js
+++ b/toolkit/components/webextensions/test/xpcshell/test_ext_background_private_browsing.js
diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_background_runtime_connect_params.js b/toolkit/components/webextensions/test/xpcshell/test_ext_background_runtime_connect_params.js
index 426833edd..426833edd 100644
--- a/toolkit/components/extensions/test/xpcshell/test_ext_background_runtime_connect_params.js
+++ b/toolkit/components/webextensions/test/xpcshell/test_ext_background_runtime_connect_params.js
diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_background_sub_windows.js b/toolkit/components/webextensions/test/xpcshell/test_ext_background_sub_windows.js
index c5f2f1332..c5f2f1332 100644
--- a/toolkit/components/extensions/test/xpcshell/test_ext_background_sub_windows.js
+++ b/toolkit/components/webextensions/test/xpcshell/test_ext_background_sub_windows.js
diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_background_window_properties.js b/toolkit/components/webextensions/test/xpcshell/test_ext_background_window_properties.js
index 948e2913e..948e2913e 100644
--- a/toolkit/components/extensions/test/xpcshell/test_ext_background_window_properties.js
+++ b/toolkit/components/webextensions/test/xpcshell/test_ext_background_window_properties.js
diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_contexts.js b/toolkit/components/webextensions/test/xpcshell/test_ext_contexts.js
index 56a14e189..56a14e189 100644
--- a/toolkit/components/extensions/test/xpcshell/test_ext_contexts.js
+++ b/toolkit/components/webextensions/test/xpcshell/test_ext_contexts.js
diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_downloads.js b/toolkit/components/webextensions/test/xpcshell/test_ext_downloads.js
index 058b9b18c..058b9b18c 100644
--- a/toolkit/components/extensions/test/xpcshell/test_ext_downloads.js
+++ b/toolkit/components/webextensions/test/xpcshell/test_ext_downloads.js
diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_downloads_download.js b/toolkit/components/webextensions/test/xpcshell/test_ext_downloads_download.js
index 37ddd4d7c..37ddd4d7c 100644
--- a/toolkit/components/extensions/test/xpcshell/test_ext_downloads_download.js
+++ b/toolkit/components/webextensions/test/xpcshell/test_ext_downloads_download.js
diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_downloads_misc.js b/toolkit/components/webextensions/test/xpcshell/test_ext_downloads_misc.js
index d08aab666..d08aab666 100644
--- a/toolkit/components/extensions/test/xpcshell/test_ext_downloads_misc.js
+++ b/toolkit/components/webextensions/test/xpcshell/test_ext_downloads_misc.js
diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_downloads_search.js b/toolkit/components/webextensions/test/xpcshell/test_ext_downloads_search.js
index 4caa82456..4caa82456 100644
--- a/toolkit/components/extensions/test/xpcshell/test_ext_downloads_search.js
+++ b/toolkit/components/webextensions/test/xpcshell/test_ext_downloads_search.js
diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_experiments.js b/toolkit/components/webextensions/test/xpcshell/test_ext_experiments.js
index bc6bfcd68..bc6bfcd68 100644
--- a/toolkit/components/extensions/test/xpcshell/test_ext_experiments.js
+++ b/toolkit/components/webextensions/test/xpcshell/test_ext_experiments.js
diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_extension.js b/toolkit/components/webextensions/test/xpcshell/test_ext_extension.js
index f18845f6a..f18845f6a 100644
--- a/toolkit/components/extensions/test/xpcshell/test_ext_extension.js
+++ b/toolkit/components/webextensions/test/xpcshell/test_ext_extension.js
diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_idle.js b/toolkit/components/webextensions/test/xpcshell/test_ext_idle.js
index 89bcac217..89bcac217 100644
--- a/toolkit/components/extensions/test/xpcshell/test_ext_idle.js
+++ b/toolkit/components/webextensions/test/xpcshell/test_ext_idle.js
diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_json_parser.js b/toolkit/components/webextensions/test/xpcshell/test_ext_json_parser.js
index 652f41315..652f41315 100644
--- a/toolkit/components/extensions/test/xpcshell/test_ext_json_parser.js
+++ b/toolkit/components/webextensions/test/xpcshell/test_ext_json_parser.js
diff --git a/toolkit/components/extensions/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/extensions/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/extensions/test/xpcshell/test_ext_legacy_extension_embedding.js b/toolkit/components/webextensions/test/xpcshell/test_ext_legacy_extension_embedding.js
index ea5d78524..ea5d78524 100644
--- a/toolkit/components/extensions/test/xpcshell/test_ext_legacy_extension_embedding.js
+++ b/toolkit/components/webextensions/test/xpcshell/test_ext_legacy_extension_embedding.js
diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_localStorage.js b/toolkit/components/webextensions/test/xpcshell/test_ext_localStorage.js
index 0f0b41085..0f0b41085 100644
--- a/toolkit/components/extensions/test/xpcshell/test_ext_localStorage.js
+++ b/toolkit/components/webextensions/test/xpcshell/test_ext_localStorage.js
diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_management.js b/toolkit/components/webextensions/test/xpcshell/test_ext_management.js
index b19554a57..b19554a57 100644
--- a/toolkit/components/extensions/test/xpcshell/test_ext_management.js
+++ b/toolkit/components/webextensions/test/xpcshell/test_ext_management.js
diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_management_uninstall_self.js b/toolkit/components/webextensions/test/xpcshell/test_ext_management_uninstall_self.js
index 7d80a9c23..7d80a9c23 100644
--- a/toolkit/components/extensions/test/xpcshell/test_ext_management_uninstall_self.js
+++ b/toolkit/components/webextensions/test/xpcshell/test_ext_management_uninstall_self.js
diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_manifest_content_security_policy.js b/toolkit/components/webextensions/test/xpcshell/test_ext_manifest_content_security_policy.js
index 2b0084980..2b0084980 100644
--- a/toolkit/components/extensions/test/xpcshell/test_ext_manifest_content_security_policy.js
+++ b/toolkit/components/webextensions/test/xpcshell/test_ext_manifest_content_security_policy.js
diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_manifest_incognito.js b/toolkit/components/webextensions/test/xpcshell/test_ext_manifest_incognito.js
index 94649692e..94649692e 100644
--- a/toolkit/components/extensions/test/xpcshell/test_ext_manifest_incognito.js
+++ b/toolkit/components/webextensions/test/xpcshell/test_ext_manifest_incognito.js
diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_manifest_minimum_chrome_version.js b/toolkit/components/webextensions/test/xpcshell/test_ext_manifest_minimum_chrome_version.js
index fad5661bb..fad5661bb 100644
--- a/toolkit/components/extensions/test/xpcshell/test_ext_manifest_minimum_chrome_version.js
+++ b/toolkit/components/webextensions/test/xpcshell/test_ext_manifest_minimum_chrome_version.js
diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_native_messaging.js b/toolkit/components/webextensions/test/xpcshell/test_ext_native_messaging.js
index 5a6b628f5..5a6b628f5 100644
--- a/toolkit/components/extensions/test/xpcshell/test_ext_native_messaging.js
+++ b/toolkit/components/webextensions/test/xpcshell/test_ext_native_messaging.js
diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_native_messaging_perf.js b/toolkit/components/webextensions/test/xpcshell/test_ext_native_messaging_perf.js
index 693f67dde..693f67dde 100644
--- a/toolkit/components/extensions/test/xpcshell/test_ext_native_messaging_perf.js
+++ b/toolkit/components/webextensions/test/xpcshell/test_ext_native_messaging_perf.js
diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_native_messaging_unresponsive.js b/toolkit/components/webextensions/test/xpcshell/test_ext_native_messaging_unresponsive.js
index a75a1d49d..a75a1d49d 100644
--- a/toolkit/components/extensions/test/xpcshell/test_ext_native_messaging_unresponsive.js
+++ b/toolkit/components/webextensions/test/xpcshell/test_ext_native_messaging_unresponsive.js
diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_onmessage_removelistener.js b/toolkit/components/webextensions/test/xpcshell/test_ext_onmessage_removelistener.js
index 6f8b553fc..6f8b553fc 100644
--- a/toolkit/components/extensions/test/xpcshell/test_ext_onmessage_removelistener.js
+++ b/toolkit/components/webextensions/test/xpcshell/test_ext_onmessage_removelistener.js
diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_runtime_connect_no_receiver.js b/toolkit/components/webextensions/test/xpcshell/test_ext_runtime_connect_no_receiver.js
index 2a1342cde..2a1342cde 100644
--- a/toolkit/components/extensions/test/xpcshell/test_ext_runtime_connect_no_receiver.js
+++ b/toolkit/components/webextensions/test/xpcshell/test_ext_runtime_connect_no_receiver.js
diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_runtime_getBrowserInfo.js b/toolkit/components/webextensions/test/xpcshell/test_ext_runtime_getBrowserInfo.js
index a280206fa..a280206fa 100644
--- a/toolkit/components/extensions/test/xpcshell/test_ext_runtime_getBrowserInfo.js
+++ b/toolkit/components/webextensions/test/xpcshell/test_ext_runtime_getBrowserInfo.js
diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_runtime_getPlatformInfo.js b/toolkit/components/webextensions/test/xpcshell/test_ext_runtime_getPlatformInfo.js
index 29bad0c10..29bad0c10 100644
--- a/toolkit/components/extensions/test/xpcshell/test_ext_runtime_getPlatformInfo.js
+++ b/toolkit/components/webextensions/test/xpcshell/test_ext_runtime_getPlatformInfo.js
diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_runtime_onInstalled_and_onStartup.js b/toolkit/components/webextensions/test/xpcshell/test_ext_runtime_onInstalled_and_onStartup.js
index fa6461412..fa6461412 100644
--- a/toolkit/components/extensions/test/xpcshell/test_ext_runtime_onInstalled_and_onStartup.js
+++ b/toolkit/components/webextensions/test/xpcshell/test_ext_runtime_onInstalled_and_onStartup.js
diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_runtime_sendMessage.js b/toolkit/components/webextensions/test/xpcshell/test_ext_runtime_sendMessage.js
index fec8e13dd..fec8e13dd 100644
--- a/toolkit/components/extensions/test/xpcshell/test_ext_runtime_sendMessage.js
+++ b/toolkit/components/webextensions/test/xpcshell/test_ext_runtime_sendMessage.js
diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_runtime_sendMessage_errors.js b/toolkit/components/webextensions/test/xpcshell/test_ext_runtime_sendMessage_errors.js
index f1a8d5a36..f1a8d5a36 100644
--- a/toolkit/components/extensions/test/xpcshell/test_ext_runtime_sendMessage_errors.js
+++ b/toolkit/components/webextensions/test/xpcshell/test_ext_runtime_sendMessage_errors.js
diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_runtime_sendMessage_no_receiver.js b/toolkit/components/webextensions/test/xpcshell/test_ext_runtime_sendMessage_no_receiver.js
index f906333d2..f906333d2 100644
--- a/toolkit/components/extensions/test/xpcshell/test_ext_runtime_sendMessage_no_receiver.js
+++ b/toolkit/components/webextensions/test/xpcshell/test_ext_runtime_sendMessage_no_receiver.js
diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_runtime_sendMessage_self.js b/toolkit/components/webextensions/test/xpcshell/test_ext_runtime_sendMessage_self.js
index e4f5e951f..e4f5e951f 100644
--- a/toolkit/components/extensions/test/xpcshell/test_ext_runtime_sendMessage_self.js
+++ b/toolkit/components/webextensions/test/xpcshell/test_ext_runtime_sendMessage_self.js
diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_schemas.js b/toolkit/components/webextensions/test/xpcshell/test_ext_schemas.js
index d838be5b5..d838be5b5 100644
--- a/toolkit/components/extensions/test/xpcshell/test_ext_schemas.js
+++ b/toolkit/components/webextensions/test/xpcshell/test_ext_schemas.js
diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_schemas_allowed_contexts.js b/toolkit/components/webextensions/test/xpcshell/test_ext_schemas_allowed_contexts.js
index 606459764..606459764 100644
--- a/toolkit/components/extensions/test/xpcshell/test_ext_schemas_allowed_contexts.js
+++ b/toolkit/components/webextensions/test/xpcshell/test_ext_schemas_allowed_contexts.js
diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_schemas_api_injection.js b/toolkit/components/webextensions/test/xpcshell/test_ext_schemas_api_injection.js
index 36d88d722..36d88d722 100644
--- a/toolkit/components/extensions/test/xpcshell/test_ext_schemas_api_injection.js
+++ b/toolkit/components/webextensions/test/xpcshell/test_ext_schemas_api_injection.js
diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_schemas_async.js b/toolkit/components/webextensions/test/xpcshell/test_ext_schemas_async.js
index 6397d1f96..6397d1f96 100644
--- a/toolkit/components/extensions/test/xpcshell/test_ext_schemas_async.js
+++ b/toolkit/components/webextensions/test/xpcshell/test_ext_schemas_async.js
diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_simple.js b/toolkit/components/webextensions/test/xpcshell/test_ext_simple.js
index 91b10354c..91b10354c 100644
--- a/toolkit/components/extensions/test/xpcshell/test_ext_simple.js
+++ b/toolkit/components/webextensions/test/xpcshell/test_ext_simple.js
diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_storage.js b/toolkit/components/webextensions/test/xpcshell/test_ext_storage.js
index df46dfb63..df46dfb63 100644
--- a/toolkit/components/extensions/test/xpcshell/test_ext_storage.js
+++ b/toolkit/components/webextensions/test/xpcshell/test_ext_storage.js
diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_topSites.js b/toolkit/components/webextensions/test/xpcshell/test_ext_topSites.js
index eb3f552ed..eb3f552ed 100644
--- a/toolkit/components/extensions/test/xpcshell/test_ext_topSites.js
+++ b/toolkit/components/webextensions/test/xpcshell/test_ext_topSites.js
diff --git a/toolkit/components/extensions/test/xpcshell/test_getAPILevelForWindow.js b/toolkit/components/webextensions/test/xpcshell/test_getAPILevelForWindow.js
index 68741a6cc..68741a6cc 100644
--- a/toolkit/components/extensions/test/xpcshell/test_getAPILevelForWindow.js
+++ b/toolkit/components/webextensions/test/xpcshell/test_getAPILevelForWindow.js
diff --git a/toolkit/components/extensions/test/xpcshell/test_locale_converter.js b/toolkit/components/webextensions/test/xpcshell/test_locale_converter.js
index c8b1ee92b..c8b1ee92b 100644
--- a/toolkit/components/extensions/test/xpcshell/test_locale_converter.js
+++ b/toolkit/components/webextensions/test/xpcshell/test_locale_converter.js
diff --git a/toolkit/components/extensions/test/xpcshell/test_locale_data.js b/toolkit/components/webextensions/test/xpcshell/test_locale_data.js
index c3cd44e57..c3cd44e57 100644
--- a/toolkit/components/extensions/test/xpcshell/test_locale_data.js
+++ b/toolkit/components/webextensions/test/xpcshell/test_locale_data.js
diff --git a/toolkit/components/extensions/test/xpcshell/test_native_messaging.js b/toolkit/components/webextensions/test/xpcshell/test_native_messaging.js
index 1fcb7799e..1fcb7799e 100644
--- a/toolkit/components/extensions/test/xpcshell/test_native_messaging.js
+++ b/toolkit/components/webextensions/test/xpcshell/test_native_messaging.js
diff --git a/toolkit/components/extensions/test/xpcshell/xpcshell.ini b/toolkit/components/webextensions/test/xpcshell/xpcshell.ini
index d2c6fd5d0..d2c6fd5d0 100644
--- a/toolkit/components/extensions/test/xpcshell/xpcshell.ini
+++ b/toolkit/components/webextensions/test/xpcshell/xpcshell.ini
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()) {