diff --git a/browser/base/content/nsContextMenu.js b/browser/base/content/nsContextMenu.js index 435e5235d843..f6e3ba768ae8 100644 --- a/browser/base/content/nsContextMenu.js +++ b/browser/base/content/nsContextMenu.js @@ -452,7 +452,7 @@ nsContextMenu.prototype = { var haveSetDesktopBackground = false; if (AppConstants.HAVE_SHELL_SERVICE && - Services.policies.isAllowed("set_desktop_background")) { + Services.policies.isAllowed("setDesktopBackground")) { // Only enable Set as Desktop Background if we can get the shell service. var shell = getShellService(); if (shell) @@ -1019,7 +1019,7 @@ nsContextMenu.prototype = { onMessage); if (message.data.disable || - !Services.policies.isAllowed("set_desktop_background")) { + !Services.policies.isAllowed("setDesktopBackground")) { return; } diff --git a/browser/base/content/test/general/browser.ini b/browser/base/content/test/general/browser.ini index a9777df2c260..8e68c790ba82 100644 --- a/browser/base/content/test/general/browser.ini +++ b/browser/base/content/test/general/browser.ini @@ -6,6 +6,7 @@ ############################################################################### [DEFAULT] +prefs = browser.cache.offline.insecure.enable=true support-files = POSTSearchEngine.xml alltabslistener.html @@ -52,8 +53,6 @@ support-files = head.js moz.png navigating_window_with_download.html - offlineQuotaNotification.cacheManifest - offlineQuotaNotification.html page_style_sample.html pinning_headers.sjs ssl_error_reports.sjs @@ -366,6 +365,7 @@ subsuite = clipboard [browser_new_http_window_opened_from_file_tab.js] # DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD. [browser_offlineQuotaNotification.js] +support-files = offlineQuotaNotification.cacheManifest offlineQuotaNotification.html skip-if = os == "linux" && !debug # bug 1304273 # DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD. [browser_feed_discovery.js] diff --git a/browser/base/content/test/general/mochitest.ini b/browser/base/content/test/general/mochitest.ini index a07a01b87328..302a633029ba 100644 --- a/browser/base/content/test/general/mochitest.ini +++ b/browser/base/content/test/general/mochitest.ini @@ -23,5 +23,3 @@ support-files = [test_bug364677.html] [test_bug395533.html] -[test_offlineNotification.html] -skip-if = e10s # Bug 1257785 diff --git a/browser/base/content/test/general/test_offlineNotification.html b/browser/base/content/test/general/test_offlineNotification.html deleted file mode 100644 index 931da1ae5ab5..000000000000 --- a/browser/base/content/test/general/test_offlineNotification.html +++ /dev/null @@ -1,121 +0,0 @@ - - - - - Test offline app notification - - - - - -

- - - - - - - - -

-
-
-
- - diff --git a/browser/components/enterprisepolicies/Policies.jsm b/browser/components/enterprisepolicies/Policies.jsm index 964cae4257c5..10d18064ee28 100644 --- a/browser/components/enterprisepolicies/Policies.jsm +++ b/browser/components/enterprisepolicies/Policies.jsm @@ -79,7 +79,15 @@ this.Policies = { "block_set_desktop_background": { onBeforeUIStartup(manager, param) { if (param == true) { - manager.disallowFeature("set_desktop_background", true); + manager.disallowFeature("setDesktopBackground", true); + } + } + }, + + "DisableFirefoxScreenshots": { + onBeforeAddons(manager, param) { + if (param == true) { + setAndLockPref("extensions.screenshots.disabled", true); } } }, diff --git a/browser/components/enterprisepolicies/schemas/policies-schema.json b/browser/components/enterprisepolicies/schemas/policies-schema.json index 714eb9120a45..08cc0669dd3e 100644 --- a/browser/components/enterprisepolicies/schemas/policies-schema.json +++ b/browser/components/enterprisepolicies/schemas/policies-schema.json @@ -34,6 +34,14 @@ "enum": [true] }, + "DisableFirefoxScreenshots": { + "description": "Prevents usage of the Firefox Screenshots feature.", + "first_available": "60.0", + + "type": "boolean", + "enum": [true] + }, + "dont_check_default_browser": { "description": "Don't check for the default browser on startup.", "first_available": "60.0", diff --git a/browser/components/enterprisepolicies/tests/browser/browser.ini b/browser/components/enterprisepolicies/tests/browser/browser.ini index 010f4a4f5650..4033d209b5d8 100644 --- a/browser/components/enterprisepolicies/tests/browser/browser.ini +++ b/browser/components/enterprisepolicies/tests/browser/browser.ini @@ -11,7 +11,9 @@ support-files = [browser_policies_setAndLockPref_API.js] [browser_policies_simple_policies.js] [browser_policies_validate_and_parse_API.js] -[browser_policy_default_browser_check.js] -[browser_policy_display_menu.js] -[browser_policy_display_bookmarks.js] [browser_policy_block_set_desktop_background.js] +[browser_policy_default_browser_check.js] +[browser_policy_disable_fxscreenshots.js] +[browser_policy_display_bookmarks.js] +[browser_policy_display_menu.js] + diff --git a/browser/components/enterprisepolicies/tests/browser/browser_policy_disable_fxscreenshots.js b/browser/components/enterprisepolicies/tests/browser/browser_policy_disable_fxscreenshots.js new file mode 100644 index 000000000000..99ea9046e669 --- /dev/null +++ b/browser/components/enterprisepolicies/tests/browser/browser_policy_disable_fxscreenshots.js @@ -0,0 +1,41 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +const PREF_DISABLE_FX_SCREENSHOTS = "extensions.screenshots.disabled"; + +async function checkScreenshots(shouldBeEnabled) { + return BrowserTestUtils.waitForCondition(() => { + return !!PageActions.actionForID("screenshots") == shouldBeEnabled; + }, "Expecting screenshots to be " + shouldBeEnabled); +} + +add_task(async function test_disable_firefox_screenshots() { + await BrowserTestUtils.withNewTab("data:text/html,Test", async function() { + await setupPolicyEngineWithJson(""); + is(Services.policies.status, Services.policies.INACTIVE, "Start with no policies"); + + // Firefox Screenshots are disabled in tests, so make sure we enable + // it first to ensure that the test is valid. + Services.prefs.setBoolPref(PREF_DISABLE_FX_SCREENSHOTS, false); + await checkScreenshots(true); + + await setupPolicyEngineWithJson({ + "policies": { + "DisableFirefoxScreenshots": true + } + }); + + is(Services.policies.status, Services.policies.ACTIVE, "Policy engine is active"); + await checkScreenshots(false); + + // Clear the change we made and make sure it remains disabled. + await setupPolicyEngineWithJson(""); + + Services.prefs.unlockPref(PREF_DISABLE_FX_SCREENSHOTS); + Services.prefs.clearUserPref(PREF_DISABLE_FX_SCREENSHOTS); + + await checkScreenshots(false); + }); +}); diff --git a/caps/ContentPrincipal.cpp b/caps/ContentPrincipal.cpp index 6eb9986620db..e6edaec35bf5 100644 --- a/caps/ContentPrincipal.cpp +++ b/caps/ContentPrincipal.cpp @@ -36,8 +36,6 @@ using namespace mozilla; -static bool gCodeBasePrincipalSupport = false; - static bool URIIsImmutable(nsIURI* aURI) { nsCOMPtr mutableObj(do_QueryInterface(aURI)); @@ -63,15 +61,6 @@ NS_IMPL_CI_INTERFACE_GETTER(ContentPrincipal, nsIPrincipal, nsISerializable) -// Called at startup: -/* static */ void -ContentPrincipal::InitializeStatics() -{ - Preferences::AddBoolVarCache(&gCodeBasePrincipalSupport, - "signed.applets.codebase_principal_support", - false); -} - ContentPrincipal::ContentPrincipal() : BasePrincipal(eCodebasePrincipal) , mCodebaseImmutable(false) diff --git a/caps/ContentPrincipal.h b/caps/ContentPrincipal.h index 4beb4be1a447..fa7c2ff09c8f 100644 --- a/caps/ContentPrincipal.h +++ b/caps/ContentPrincipal.h @@ -40,11 +40,6 @@ public: virtual nsresult GetScriptLocation(nsACString& aStr) override; - /** - * Called at startup to setup static data, e.g. about:config pref-observers. - */ - static void InitializeStatics(); - static nsresult GenerateOriginNoSuffixFromURI(nsIURI* aURI, nsACString& aOrigin); diff --git a/devtools/client/commandline/test/browser.ini b/devtools/client/commandline/test/browser.ini index 19ffed212930..70c4f0237307 100644 --- a/devtools/client/commandline/test/browser.ini +++ b/devtools/client/commandline/test/browser.ini @@ -22,6 +22,7 @@ support-files = browser_cmd_appcache_invalid_page3.html browser_cmd_appcache_invalid_page3.html^headers^ [browser_cmd_appcache_valid.js] +skip-if = !e10s support-files = browser_cmd_appcache_valid_appcache.appcache browser_cmd_appcache_valid_appcache.appcache^headers^ diff --git a/devtools/client/commandline/test/browser_cmd_appcache_invalid.js b/devtools/client/commandline/test/browser_cmd_appcache_invalid.js index c6ac38631d7b..e9d9a87c56fe 100644 --- a/devtools/client/commandline/test/browser_cmd_appcache_invalid.js +++ b/devtools/client/commandline/test/browser_cmd_appcache_invalid.js @@ -1,10 +1,11 @@ /* Any copyright is dedicated to the Public Domain. * http://creativecommons.org/publicdomain/zero/1.0/ */ +"use strict"; // Tests that the appcache validate works as they should with an invalid // manifest. -const TEST_URI = "http://sub1.test1.example.com/browser/devtools/client/commandline/" + +const TEST_URI = "https://sub1.test1.example.com/browser/devtools/client/commandline/" + "test/browser_cmd_appcache_invalid_index.html"; function test() { @@ -36,26 +37,26 @@ function* spawnTest() { "test.png points to a resource that is not available at line 25.", "/main/features.js points to a resource that is not available at line 27.", "/main/settings/index.css points to a resource that is not available at line 28.", - "http://example.com/scene.jpg points to a resource that is not available at line 29.", + "https://example.com/scene.jpg points to a resource that is not available at line 29.", "/section1/blockedbyfallback.html points to a resource that is not available at line 30.", - "http://example.com/images/world.jpg points to a resource that is not available at line 31.", + "https://example.com/images/world.jpg points to a resource that is not available at line 31.", "/section2/blockedbyfallback.html points to a resource that is not available at line 32.", "/main/home points to a resource that is not available at line 34.", "main/app.js points to a resource that is not available at line 35.", "/settings/home points to a resource that is not available at line 37.", "/settings/app.js points to a resource that is not available at line 38.", - "The file http://sub1.test1.example.com/browser/devtools/client/" + + "The file https://sub1.test1.example.com/browser/devtools/client/" + "commandline/test/browser_cmd_appcache_invalid_page3.html was modified " + - "after http://sub1.test1.example.com/browser/devtools/client/" + + "after https://sub1.test1.example.com/browser/devtools/client/" + "commandline/test/browser_cmd_appcache_invalid_appcache.appcache. Unless " + "the text in the manifest file is changed the cached version will be used " + "instead at line 39.", "browser_cmd_appcache_invalid_page3.html has cache-control set to no-store. " + "This will prevent the application cache from storing the file at line 39.", - "http://example.com/logo.png points to a resource that is not available at line 40.", - "http://example.com/check.png points to a resource that is not available at line 41.", + "https://example.com/logo.png points to a resource that is not available at line 40.", + "https://example.com/check.png points to a resource that is not available at line 41.", "Spaces in URIs need to be replaced with %20 at line 42.", - "http://example.com/cr oss.png points to a resource that is not available at line 42.", + "https://example.com/cr oss.png points to a resource that is not available at line 42.", "Asterisk (*) incorrectly used in the CACHE section at line 43. If a line " + "in the NETWORK section contains only a single asterisk character, then " + "any URI not listed in the manifest will be treated as if the URI was " + diff --git a/devtools/client/commandline/test/browser_cmd_appcache_invalid_appcache.appcache b/devtools/client/commandline/test/browser_cmd_appcache_invalid_appcache.appcache index 75b5d7bad95f..af0ae05854e9 100644 --- a/devtools/client/commandline/test/browser_cmd_appcache_invalid_appcache.appcache +++ b/devtools/client/commandline/test/browser_cmd_appcache_invalid_appcache.appcache @@ -26,9 +26,9 @@ test.png browser_cmd_appcache_invalid_index.html /main/features.js /main/settings/index.css -http://example.com/scene.jpg +https://example.com/scene.jpg /section1/blockedbyfallback.html -http://example.com/images/world.jpg +https://example.com/images/world.jpg /section2/blockedbyfallback.html browser_cmd_appcache_invalid_page1.html /main/home @@ -37,9 +37,9 @@ browser_cmd_appcache_invalid_page2.html /settings/home /settings/app.js browser_cmd_appcache_invalid_page3.html -http://example.com/logo.png -http://example.com/check.png -http://example.com/cr oss.png +https://example.com/logo.png +https://example.com/check.png +https://example.com/cr oss.png /checking*.png SETTINGS: diff --git a/devtools/client/commandline/test/browser_cmd_appcache_valid.js b/devtools/client/commandline/test/browser_cmd_appcache_valid.js index 83aa9ca8fa05..a0eefc787b30 100644 --- a/devtools/client/commandline/test/browser_cmd_appcache_valid.js +++ b/devtools/client/commandline/test/browser_cmd_appcache_valid.js @@ -1,9 +1,10 @@ /* Any copyright is dedicated to the Public Domain. * http://creativecommons.org/publicdomain/zero/1.0/ */ +"use strict"; // Tests that the appcache commands works as they should -const TEST_URI = "http://sub1.test2.example.com/browser/devtools/client/" + +const TEST_URI = "https://sub1.test2.example.com/browser/devtools/client/" + "commandline/test/browser_cmd_appcache_valid_index.html"; function test() { @@ -110,7 +111,7 @@ function* spawnTest() { setup: "appcache validate " + TEST_URI, check: { input: "appcache validate " + TEST_URI, - // appcache validate http://sub1.test2.example.com/browser/devtools/client/commandline/test/browser_cmd_appcache_valid_index.html + // appcache validate https://sub1.test2.example.com/browser/devtools/client/commandline/test/browser_cmd_appcache_valid_index.html markup: "VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV", status: "VALID", args: { @@ -160,7 +161,7 @@ function* spawnTest() { setup: "appcache viewentry --key " + TEST_URI, check: { input: "appcache viewentry --key " + TEST_URI, - // appcache viewentry --key http://sub1.test2.example.com/browser/devtools/client/commandline/test/browser_cmd_appcache_valid_index.html + // appcache viewentry --key https://sub1.test2.example.com/browser/devtools/client/commandline/test/browser_cmd_appcache_valid_index.html markup: "VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV", status: "VALID", args: {} diff --git a/dom/base/nsDeprecatedOperationList.h b/dom/base/nsDeprecatedOperationList.h index e0208be35780..e303350d20a1 100644 --- a/dom/base/nsDeprecatedOperationList.h +++ b/dom/base/nsDeprecatedOperationList.h @@ -32,6 +32,7 @@ DEPRECATED_OPERATION(NavigatorGetUserMedia) DEPRECATED_OPERATION(WebrtcDeprecatedPrefix) DEPRECATED_OPERATION(RTCPeerConnectionGetStreams) DEPRECATED_OPERATION(AppCache) +DEPRECATED_OPERATION(AppCacheInsecure) DEPRECATED_OPERATION(PrefixedImageSmoothingEnabled) DEPRECATED_OPERATION(PrefixedFullscreenAPI) DEPRECATED_OPERATION(LenientSetter) diff --git a/dom/base/nsGlobalWindowInner.cpp b/dom/base/nsGlobalWindowInner.cpp index fe053a33ec1e..233f754058b2 100644 --- a/dom/base/nsGlobalWindowInner.cpp +++ b/dom/base/nsGlobalWindowInner.cpp @@ -2973,6 +2973,13 @@ nsGlobalWindowInner::IsPrivilegedChromeWindow(JSContext* aCx, JSObject* aObj) nsContentUtils::ObjectPrincipal(aObj) == nsContentUtils::GetSystemPrincipal(); } +/* static */ bool +nsGlobalWindowInner::OfflineCacheAllowedForContext(JSContext* aCx, JSObject* aObj) +{ + return IsSecureContextOrObjectIsFromSecureContext(aCx, aObj) || + Preferences::GetBool("browser.cache.offline.insecure.enable"); +} + /* static */ bool nsGlobalWindowInner::IsRequestIdleCallbackEnabled(JSContext* aCx, JSObject* aObj) { diff --git a/dom/base/nsGlobalWindowInner.h b/dom/base/nsGlobalWindowInner.h index 47cb1cc3f2a0..9642bf0db6bb 100644 --- a/dom/base/nsGlobalWindowInner.h +++ b/dom/base/nsGlobalWindowInner.h @@ -399,6 +399,8 @@ public: static bool IsPrivilegedChromeWindow(JSContext* /* unused */, JSObject* aObj); + static bool OfflineCacheAllowedForContext(JSContext* /* unused */, JSObject* aObj); + static bool IsRequestIdleCallbackEnabled(JSContext* aCx, JSObject* /* unused */); static bool IsWindowPrintEnabled(JSContext* /* unused */, JSObject* /* unused */); diff --git a/dom/ipc/ContentPrefs.cpp b/dom/ipc/ContentPrefs.cpp index 35be2ff6f936..045b6f78c305 100644 --- a/dom/ipc/ContentPrefs.cpp +++ b/dom/ipc/ContentPrefs.cpp @@ -307,7 +307,6 @@ const char* mozilla::dom::ContentPrefs::gEarlyPrefs[] = { "security.sandbox.logging.enabled", "security.sandbox.mac.track.violations", "security.sandbox.windows.log.stackTraceDepth", - "signed.applets.codebase_principal_support", "svg.disabled", "svg.display-lists.hit-testing.enabled", "svg.display-lists.painting.enabled", diff --git a/dom/locales/en-US/chrome/dom/dom.properties b/dom/locales/en-US/chrome/dom/dom.properties index bc398b699b57..6749d0b6c373 100644 --- a/dom/locales/en-US/chrome/dom/dom.properties +++ b/dom/locales/en-US/chrome/dom/dom.properties @@ -187,6 +187,8 @@ HittingMaxWorkersPerDomain2=A Worker could not be started immediately because ot PannerNodeDopplerWarning=Use of setVelocity on the PannerNode and AudioListener, and speedOfSound and dopplerFactor on the AudioListener are deprecated and those members will be removed. For more help https://developer.mozilla.org/en-US/docs/Web/API/AudioListener#Deprecated_features # LOCALIZATION NOTE: Do not translate "Application Cache API", "AppCache" and "ServiceWorker". AppCacheWarning=The Application Cache API (AppCache) is deprecated and will be removed at a future date. Please consider using ServiceWorker for offline support. +# LOCALIZATION NOTE: Do not translate "Application Cache API", "AppCache". +AppCacheInsecureWarning=Use of the Application Cache API (AppCache) for insecure connections will be removed in version 62. # LOCALIZATION NOTE: Do not translate "Worker". EmptyWorkerSourceWarning=Attempting to create a Worker from an empty source. This is probably unintentional. WebrtcDeprecatedPrefixWarning=WebRTC interfaces with the “moz” prefix (mozRTCPeerConnection, mozRTCSessionDescription, mozRTCIceCandidate) have been deprecated. diff --git a/dom/tests/mochitest/ajax/offline/.eslintrc.js b/dom/tests/mochitest/ajax/offline/.eslintrc.js new file mode 100644 index 000000000000..a21be714bd4e --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/.eslintrc.js @@ -0,0 +1,9 @@ +"use strict"; + +module.exports = { + "globals": { + "SimpleTest": true, + "OfflineTest": true, + "SpecialPowers": true, + } +}; diff --git a/dom/tests/mochitest/ajax/offline/445544.cacheManifest b/dom/tests/mochitest/ajax/offline/445544.cacheManifest index eb957d3df1fd..344ab53a3f31 100644 --- a/dom/tests/mochitest/ajax/offline/445544.cacheManifest +++ b/dom/tests/mochitest/ajax/offline/445544.cacheManifest @@ -1,6 +1,6 @@ CACHE MANIFEST -http://mochi.test:8888/tests/SimpleTest/SimpleTest.js -http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js +https://example.com/tests/SimpleTest/SimpleTest.js +https://example.com/tests/dom/tests/mochitest/ajax/offline/offlineTests.js test_bug445544.html 445544_part1.html diff --git a/dom/tests/mochitest/ajax/offline/744719-cancel.cacheManifest b/dom/tests/mochitest/ajax/offline/744719-cancel.cacheManifest index a8a7a3bf6f0b..c0f4b855c576 100644 --- a/dom/tests/mochitest/ajax/offline/744719-cancel.cacheManifest +++ b/dom/tests/mochitest/ajax/offline/744719-cancel.cacheManifest @@ -1,7 +1,7 @@ CACHE MANIFEST -http://mochi.test:8888/tests/SimpleTest/SimpleTest.js -http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js +https://example.com/tests/SimpleTest/SimpleTest.js +https://example.com/tests/dom/tests/mochitest/ajax/offline/offlineTests.js # more than 15 what is a number of parallel loads subresource744719.html?001 diff --git a/dom/tests/mochitest/ajax/offline/744719.cacheManifest b/dom/tests/mochitest/ajax/offline/744719.cacheManifest index c8246cb44d61..f6ac2986e725 100644 --- a/dom/tests/mochitest/ajax/offline/744719.cacheManifest +++ b/dom/tests/mochitest/ajax/offline/744719.cacheManifest @@ -1,7 +1,7 @@ CACHE MANIFEST -http://mochi.test:8888/tests/SimpleTest/SimpleTest.js -http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js +https://example.com/tests/SimpleTest/SimpleTest.js +https://example.com/tests/dom/tests/mochitest/ajax/offline/offlineTests.js # more than 15 what is a number of parallel loads subresource744719.html?001 diff --git a/dom/tests/mochitest/ajax/offline/badManifestMagic.cacheManifest b/dom/tests/mochitest/ajax/offline/badManifestMagic.cacheManifest index 18d84ab6e68f..97ce7363f47d 100644 --- a/dom/tests/mochitest/ajax/offline/badManifestMagic.cacheManifest +++ b/dom/tests/mochitest/ajax/offline/badManifestMagic.cacheManifest @@ -1,3 +1,3 @@ # This doesn't start with the magic cache manifest line. -http://mochi.test:8888/tests/SimpleTest/SimpleTest.js -http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js +https://example.com/tests/SimpleTest/SimpleTest.js +https://example.com/tests/dom/tests/mochitest/ajax/offline/offlineTests.js diff --git a/dom/tests/mochitest/ajax/offline/browser.ini b/dom/tests/mochitest/ajax/offline/browser.ini new file mode 100644 index 000000000000..3935dd31521c --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/browser.ini @@ -0,0 +1,8 @@ +[DEFAULT] +support-files = + file_simpleManifest.html + file_testFile.sjs + file_simpleManifest.cacheManifest + +[browser_disableAppcache.js] +skip-if = !e10s || (toolkit == 'android') || debug # Slow diff --git a/dom/tests/mochitest/ajax/offline/browser_disableAppcache.js b/dom/tests/mochitest/ajax/offline/browser_disableAppcache.js new file mode 100644 index 000000000000..2693ef09fd56 --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/browser_disableAppcache.js @@ -0,0 +1,134 @@ +const PATH = + "http://example.com/browser/dom/tests/mochitest/ajax/offline/"; +const URL = PATH + "file_simpleManifest.html"; +const MANIFEST = PATH + "file_simpleManifest.cacheManifest"; +const PREF_INSECURE_APPCACHE = "browser.cache.offline.insecure.enable"; +const PREF_NETWORK_PROXY = "network.proxy.type"; + +function setSJSState(sjsPath, stateQuery) { + let client = new XMLHttpRequest(); + client.open("GET", sjsPath + "?state=" + stateQuery, false); + let appcachechannel = SpecialPowers.wrap(client).channel.QueryInterface(Ci.nsIApplicationCacheChannel); + + return new Promise((resolve, reject) => { + client.addEventListener("load", resolve); + client.addEventListener("error", reject); + + appcachechannel.chooseApplicationCache = false; + appcachechannel.inheritApplicationCache = false; + appcachechannel.applicationCache = null; + + client.send(); + }); +} + +add_task(async function() { + /* This test loads "evil" content and verified it isn't loaded when appcache is disabled, which emulates loading stale cache from an untrusted network: + - Sets frame to load "evil" content + - Loads HTML file which also loads and caches content into AppCache + - Sets frame to load "good" + - Check we still have "evil" content from AppCache + - Disables appcache + - Check content is "good" + */ + await SpecialPowers.pushPrefEnv({ + set: [ + [PREF_INSECURE_APPCACHE, true] + ] + }); + await setSJSState(PATH + "file_testFile.sjs", "evil"); + await BrowserTestUtils.openNewForegroundTab(gBrowser, URL); + await ContentTask.spawn(gBrowser.selectedBrowser, null, async () => { + let windowPromise = new Promise((resolve, reject) => { + function init() { + if (content.document.readyState == "complete") { + const frame = content.document.getElementById("childframe"); + const state = frame.contentDocument.getElementById("state"); + is(state.textContent, "evil", "Loaded evil content"); + resolve(); + } + } + content.document.onreadystatechange = init; + init(); + }); + let appcachePromise = new Promise((resolve, reject) => { + function appcacheInit() { + if (content.applicationCache.status === content.applicationCache.IDLE) { + ok(true, "Application cache loaded"); + resolve(); + } else { + info("State was: " + content.applicationCache.status); + } + } + content.applicationCache.oncached = appcacheInit; + content.applicationCache.onnoupdate = appcacheInit; + content.applicationCache.onerror = () => { + ok(false, "Application cache failed"); + reject(); + }; + appcacheInit(); + }); + await Promise.all([windowPromise, appcachePromise]); + }); + gBrowser.removeCurrentTab(); + + // Turn network and proxy off so we can check the content loads still + await setSJSState(PATH + "file_testFile.sjs", "good"); + Services.cache2.clear(); + + // Check we still have the "evil" content despite the state change + await BrowserTestUtils.openNewForegroundTab(gBrowser, URL); + await ContentTask.spawn(gBrowser.selectedBrowser, null, async () => { + const frame = content.document.getElementById("childframe"); + const state = frame.contentDocument.getElementById("state"); + is(state.textContent, "evil", "Loaded evil content from cache"); + }); + gBrowser.removeCurrentTab(); + + + await SpecialPowers.pushPrefEnv({ + set: [ + [PREF_INSECURE_APPCACHE, false] + ] + }); + await BrowserTestUtils.openNewForegroundTab(gBrowser, URL); + + // Check that the "good" content is back now appcache is disabled + await ContentTask.spawn(gBrowser.selectedBrowser, [URL], async (URL) => { + const frame = content.document.getElementById("childframe"); + const state = frame.contentDocument.getElementById("state"); + is(state.textContent, "good", "Loaded good content"); + // Eval is needed to execure in child context. + content.window.eval("OfflineTest.clear()"); + }); + + gBrowser.removeCurrentTab(); + await setSJSState(PATH + "file_testFile.sjs", ""); + await SpecialPowers.popPrefEnv(); +}); + +add_task(async function test_pref_removes_api() { + await SpecialPowers.pushPrefEnv({ + set: [ + [PREF_INSECURE_APPCACHE, true] + ] + }); + await BrowserTestUtils.openNewForegroundTab(gBrowser, URL); + await ContentTask.spawn(gBrowser.selectedBrowser, null, async () => { + // Have to use in page checking as IsSecureContextOrObjectIsFromSecureContext is true for spawn() + is(content.document.getElementById("hasAppcache").textContent, "yes", "Appcache is enabled"); + }); + gBrowser.removeCurrentTab(); + + await SpecialPowers.pushPrefEnv({ + set: [ + [PREF_INSECURE_APPCACHE, false] + ] + }); + await BrowserTestUtils.openNewForegroundTab(gBrowser, URL); + await ContentTask.spawn(gBrowser.selectedBrowser, [URL], async (URL) => { + is(content.document.getElementById("hasAppcache").textContent, "no", "Appcache is disabled"); + content.window.eval("OfflineTest.clear()"); + }); + gBrowser.removeCurrentTab(); +}); diff --git a/dom/tests/mochitest/ajax/offline/dynamicRedirect.sjs b/dom/tests/mochitest/ajax/offline/dynamicRedirect.sjs index 1ce865a8ac44..d2bb845f605f 100644 --- a/dom/tests/mochitest/ajax/offline/dynamicRedirect.sjs +++ b/dom/tests/mochitest/ajax/offline/dynamicRedirect.sjs @@ -14,7 +14,7 @@ function handleRequest(request, response) { case "": // The default value response.setStatusLine(request.httpVersion, 307, "Moved temporarly"); - response.setHeader("Location", "http://example.com/non-existing-dynamic.html"); + response.setHeader("Location", "https://example.org/non-existing-dynamic.html"); response.setHeader("Content-Type", "text/html"); break; case "on": diff --git a/dom/tests/mochitest/ajax/offline/explicitRedirect.sjs b/dom/tests/mochitest/ajax/offline/explicitRedirect.sjs index 54da8be5dc87..501d1a71d4cf 100644 --- a/dom/tests/mochitest/ajax/offline/explicitRedirect.sjs +++ b/dom/tests/mochitest/ajax/offline/explicitRedirect.sjs @@ -14,7 +14,7 @@ function handleRequest(request, response) { case "": // The default value response.setStatusLine(request.httpVersion, 307, "Moved temporarly"); - response.setHeader("Location", "http://example.com/non-existing-explicit.html"); + response.setHeader("Location", "https://example.com/non-existing-explicit.html"); response.setHeader("Content-Type", "text/html"); break; case "on": diff --git a/dom/tests/mochitest/ajax/offline/fallback.cacheManifest b/dom/tests/mochitest/ajax/offline/fallback.cacheManifest index ec31b2a4a882..dad050991b14 100644 --- a/dom/tests/mochitest/ajax/offline/fallback.cacheManifest +++ b/dom/tests/mochitest/ajax/offline/fallback.cacheManifest @@ -1,6 +1,6 @@ CACHE MANIFEST -http://mochi.test:8888/tests/SimpleTest/SimpleTest.js -http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js +https://example.com/tests/SimpleTest/SimpleTest.js +https://example.com/tests/dom/tests/mochitest/ajax/offline/offlineTests.js FALLBACK: namespace1/ fallback.html diff --git a/dom/tests/mochitest/ajax/offline/file_simpleManifest.cacheManifest b/dom/tests/mochitest/ajax/offline/file_simpleManifest.cacheManifest new file mode 100644 index 000000000000..a6b430488b78 --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/file_simpleManifest.cacheManifest @@ -0,0 +1,5 @@ +CACHE MANIFEST +http://example.com/browser/dom/tests/mochitest/ajax/offline/file_testFile.sjs +http://example.com/browser/dom/tests/mochitest/ajax/offline/file_simpleManifest.html +http://example.com/tests/dom/tests/mochitest/ajax/offline/offlineTests.js + diff --git a/dom/tests/mochitest/ajax/offline/file_simpleManifest.html b/dom/tests/mochitest/ajax/offline/file_simpleManifest.html new file mode 100644 index 000000000000..b7eb43b95199 --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/file_simpleManifest.html @@ -0,0 +1,20 @@ + + +load manifest test + + + + + + +Offline testing
+We have AppCache:
+ + + + diff --git a/dom/tests/mochitest/ajax/offline/file_testFile.sjs b/dom/tests/mochitest/ajax/offline/file_testFile.sjs new file mode 100644 index 000000000000..62d020b355eb --- /dev/null +++ b/dom/tests/mochitest/ajax/offline/file_testFile.sjs @@ -0,0 +1,25 @@ +function handleRequest(request, response) { + var match = request.queryString.match(/^state=(.*)$/); + if (match) { + response.setStatusLine(request.httpVersion, 204, "No content"); + setState("version", match[1]); + return; + } + const state = getState("version"); + let color = "green"; + if (state === "evil") { + color = "red"; + } + const frameContent = ` + + + + + + +

Offline file: ${state}

+ `; + response.setHeader("Content-Type", "text/html"); + response.setHeader("Cache-Control", "no-cache"); + response.write(frameContent); +} diff --git a/dom/tests/mochitest/ajax/offline/foreign2.html b/dom/tests/mochitest/ajax/offline/foreign2.html index 40d5dc11dda5..62cbb1e5be04 100644 --- a/dom/tests/mochitest/ajax/offline/foreign2.html +++ b/dom/tests/mochitest/ajax/offline/foreign2.html @@ -1,4 +1,4 @@ - + Foreign page 2 @@ -14,13 +14,13 @@ function manifestUpdated() .getService(SpecialPowers.Ci.nsIApplicationCacheService); var foreign2cache = appCacheService.chooseApplicationCache( - "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/foreign2.html", OfflineTest.loadContextInfo()); + "https://example.com/tests/dom/tests/mochitest/ajax/offline/foreign2.html", OfflineTest.loadContextInfo()); window.opener.OfflineTest.ok(foreign2cache, "Foreign 2 cache present, chosen for foreign2.html"); - window.opener.OfflineTest.is(foreign2cache.manifestURI.asciiSpec, "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/foreign2.cacheManifest") + window.opener.OfflineTest.is(foreign2cache.manifestURI.asciiSpec, "https://example.com/tests/dom/tests/mochitest/ajax/offline/foreign2.cacheManifest"); var foreign1cache = OfflineTest.getActiveCache( - "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/foreign1.cacheManifest"); + "https://example.com/tests/dom/tests/mochitest/ajax/offline/foreign1.cacheManifest"); window.opener.OfflineTest.ok(foreign1cache, "Foreign 1 cache loaded"); foreign1cache.discard(); @@ -33,15 +33,15 @@ function onLoaded() .getService(SpecialPowers.Ci.nsIApplicationCacheService); var foreign1cache = window.opener.OfflineTest.getActiveCache( - "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/foreign1.cacheManifest"); + "https://example.com/tests/dom/tests/mochitest/ajax/offline/foreign1.cacheManifest"); window.opener.OfflineTest.ok(foreign1cache, "Foreign 1 cache loaded"); var foreign2cache = window.opener.OfflineTest.getActiveCache( - "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/foreign2.cacheManifest"); + "https://example.com/tests/dom/tests/mochitest/ajax/offline/foreign2.cacheManifest"); window.opener.OfflineTest.ok(!foreign2cache, "Foreign 2 cache not present"); foreign1cache = appCacheService.chooseApplicationCache( - "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/foreign2.html", window.opener.OfflineTest.loadContextInfo()); + "https://example.com/tests/dom/tests/mochitest/ajax/offline/foreign2.html", window.opener.OfflineTest.loadContextInfo()); window.opener.OfflineTest.ok(!foreign1cache, "foreign2.html not chosen from foreign1 cache"); try diff --git a/dom/tests/mochitest/ajax/offline/manifestRedirect.sjs b/dom/tests/mochitest/ajax/offline/manifestRedirect.sjs index 55326a4cf15a..5f562ec31048 100644 --- a/dom/tests/mochitest/ajax/offline/manifestRedirect.sjs +++ b/dom/tests/mochitest/ajax/offline/manifestRedirect.sjs @@ -1,6 +1,6 @@ function handleRequest(request, response) { response.setStatusLine(request.httpVersion, 307, "Moved temporarly"); - response.setHeader("Location", "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/updating.cacheManifest"); + response.setHeader("Location", "https://example.com/tests/dom/tests/mochitest/ajax/offline/updating.cacheManifest"); response.setHeader("Content-Type", "text/cache-manifest"); } diff --git a/dom/tests/mochitest/ajax/offline/missingFile.cacheManifest b/dom/tests/mochitest/ajax/offline/missingFile.cacheManifest index 4fe7cacfcd56..4c0bf27a137e 100644 --- a/dom/tests/mochitest/ajax/offline/missingFile.cacheManifest +++ b/dom/tests/mochitest/ajax/offline/missingFile.cacheManifest @@ -1,6 +1,6 @@ CACHE MANIFEST -http://mochi.test:8888/tests/SimpleTest/SimpleTest.js -http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js +https://example.com/tests/SimpleTest/SimpleTest.js +https://example.com/tests/dom/tests/mochitest/ajax/offline/offlineTests.js # The following item doesn't exist, and will cause an update error. -http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/doesntExist.html +https://example.com/tests/dom/tests/mochitest/ajax/offline/doesntExist.html diff --git a/dom/tests/mochitest/ajax/offline/mochitest.ini b/dom/tests/mochitest/ajax/offline/mochitest.ini index 961b143b6b48..b24fce877895 100644 --- a/dom/tests/mochitest/ajax/offline/mochitest.ini +++ b/dom/tests/mochitest/ajax/offline/mochitest.ini @@ -1,4 +1,5 @@ [DEFAULT] +scheme = https skip-if = toolkit == 'android' || e10s #SLOW_DIRECTORY support-files = 445544.cacheManifest diff --git a/dom/tests/mochitest/ajax/offline/namespace1/redirectToDifferentOrigin.sjs b/dom/tests/mochitest/ajax/offline/namespace1/redirectToDifferentOrigin.sjs index 22e9e146c04e..a64e00e044c8 100644 --- a/dom/tests/mochitest/ajax/offline/namespace1/redirectToDifferentOrigin.sjs +++ b/dom/tests/mochitest/ajax/offline/namespace1/redirectToDifferentOrigin.sjs @@ -1,6 +1,6 @@ function handleRequest(request, response) { response.setStatusLine(request.httpVersion, 307, "Moved temporarly"); - response.setHeader("Location", "http://example.org/tests/dom/tests/mochitest/ajax/offline/fallback2.html"); + response.setHeader("Location", "https://example.org/tests/dom/tests/mochitest/ajax/offline/fallback2.html"); response.setHeader("Content-Type", "text/html"); } diff --git a/dom/tests/mochitest/ajax/offline/obsolete.html b/dom/tests/mochitest/ajax/offline/obsolete.html index 5f0106d3af2a..6c76529e8c9f 100644 --- a/dom/tests/mochitest/ajax/offline/obsolete.html +++ b/dom/tests/mochitest/ajax/offline/obsolete.html @@ -48,7 +48,7 @@ applicationCache.oncached = function() { // Make the obsoleting.sjs return 404 NOT FOUND code var req = new XMLHttpRequest(); - req.open("GET", "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/obsoletingManifest.sjs?state="); + req.open("GET", "https://example.com/tests/dom/tests/mochitest/ajax/offline/obsoletingManifest.sjs?state="); var channel = SpecialPowers.wrap(req).channel .QueryInterface(SpecialPowers.Ci.nsIApplicationCacheChannel); channel.chooseApplicationCache = false; diff --git a/dom/tests/mochitest/ajax/offline/offlineTests.js b/dom/tests/mochitest/ajax/offline/offlineTests.js index 1364866a75e0..ddcc2f387b42 100644 --- a/dom/tests/mochitest/ajax/offline/offlineTests.js +++ b/dom/tests/mochitest/ajax/offline/offlineTests.js @@ -323,8 +323,16 @@ getActiveCache: function(overload) // one associated with this window. var serv = Cc["@mozilla.org/network/application-cache-service;1"] .getService(Ci.nsIApplicationCacheService); + var groupID = serv.buildGroupIDForInfo(this.manifestURL(overload), this.loadContextInfo()); - return serv.getActiveCache(groupID); + var cache; + // Sometimes this throws a NS_ERROR_UNEXPECTED when cache isn't init + try { + cache = serv.getActiveCache(groupID); + } catch (e) { + cache = false; + } + return cache; }, getActiveStorage: function() diff --git a/dom/tests/mochitest/ajax/offline/overlap.cacheManifest b/dom/tests/mochitest/ajax/offline/overlap.cacheManifest index e75e48aff597..8b8e8c118a27 100644 --- a/dom/tests/mochitest/ajax/offline/overlap.cacheManifest +++ b/dom/tests/mochitest/ajax/offline/overlap.cacheManifest @@ -1,8 +1,8 @@ CACHE MANIFEST CACHE: -http://mochi.test:8888/tests/SimpleTest/SimpleTest.js -http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js +https://example.com/tests/SimpleTest/SimpleTest.js +https://example.com/tests/dom/tests/mochitest/ajax/offline/offlineTests.js NETWORK: bogus/specific/ diff --git a/dom/tests/mochitest/ajax/offline/redirects.sjs b/dom/tests/mochitest/ajax/offline/redirects.sjs index 08a300157451..fb2e0ce902fc 100644 --- a/dom/tests/mochitest/ajax/offline/redirects.sjs +++ b/dom/tests/mochitest/ajax/offline/redirects.sjs @@ -2,25 +2,25 @@ ver1manifest = "CACHE MANIFEST\n" + "# v1\n" + "\n" + - "http://mochi.test:8888/tests/SimpleTest/SimpleTest.js\n" + - "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js\n" + - "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/explicitRedirect.sjs"; + "https://example.com/tests/SimpleTest/SimpleTest.js\n" + + "https://example.com/tests/dom/tests/mochitest/ajax/offline/offlineTests.js\n" + + "https://example.com/tests/dom/tests/mochitest/ajax/offline/explicitRedirect.sjs"; ver2manifest = "CACHE MANIFEST\n" + "# v2\n" + "\n" + - "http://mochi.test:8888/tests/SimpleTest/SimpleTest.js\n" + - "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js\n" + - "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/explicitRedirect.sjs"; + "https://example.com/tests/SimpleTest/SimpleTest.js\n" + + "https://example.com/tests/dom/tests/mochitest/ajax/offline/offlineTests.js\n" + + "https://example.com/tests/dom/tests/mochitest/ajax/offline/explicitRedirect.sjs"; ver3manifest = "CACHE MANIFEST\n" + "# v3\n" + "\n" + - "http://mochi.test:8888/tests/SimpleTest/SimpleTest.js\n" + - "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js\n" + - "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/explicitRedirect.sjs"; + "https://example.com/tests/SimpleTest/SimpleTest.js\n" + + "https://example.com/tests/dom/tests/mochitest/ajax/offline/offlineTests.js\n" + + "https://example.com/tests/dom/tests/mochitest/ajax/offline/explicitRedirect.sjs"; function handleRequest(request, response) { diff --git a/dom/tests/mochitest/ajax/offline/simpleManifest.cacheManifest b/dom/tests/mochitest/ajax/offline/simpleManifest.cacheManifest index aa7bf6335d31..c9d152bc5afc 100644 --- a/dom/tests/mochitest/ajax/offline/simpleManifest.cacheManifest +++ b/dom/tests/mochitest/ajax/offline/simpleManifest.cacheManifest @@ -1,6 +1,6 @@ CACHE MANIFEST -http://mochi.test:8888/tests/SimpleTest/SimpleTest.js -http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js +https://example.com/tests/SimpleTest/SimpleTest.js +https://example.com/tests/dom/tests/mochitest/ajax/offline/offlineTests.js # The following item is not a valid URI and will be ignored bad:/uri/invalid diff --git a/dom/tests/mochitest/ajax/offline/test_badManifestMagic.html b/dom/tests/mochitest/ajax/offline/test_badManifestMagic.html index f7811bcd5fb5..7d2e5d5a0376 100644 --- a/dom/tests/mochitest/ajax/offline/test_badManifestMagic.html +++ b/dom/tests/mochitest/ajax/offline/test_badManifestMagic.html @@ -1,4 +1,4 @@ - + bad manifest magic @@ -21,8 +21,8 @@ function handleError() { // These items are listed in the manifest, but the error should have // prevented them from being committed to the cache. var entries = [ - ["http://mochi.test:8888/tests/SimpleTest/SimpleTest.js", false], - ["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js", false] + ["https://example.com/tests/SimpleTest/SimpleTest.js", false], + ["https://example.com/tests/dom/tests/mochitest/ajax/offline/offlineTests.js", false] ]; OfflineTest.checkCacheEntries(entries, finishTest); } diff --git a/dom/tests/mochitest/ajax/offline/test_bug460353.html b/dom/tests/mochitest/ajax/offline/test_bug460353.html index 683d53d6ac10..f8aeb514602b 100644 --- a/dom/tests/mochitest/ajax/offline/test_bug460353.html +++ b/dom/tests/mochitest/ajax/offline/test_bug460353.html @@ -1,4 +1,4 @@ - + Bug 460353 @@ -73,8 +73,8 @@ function finish() SimpleTest.is(result["noman"].cacheStatus || -1, -1, "Frame with no manifest cache status was undefined"); OfflineTest.waitForUpdates(function() { - cleanCache("http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/simpleManifest.cacheManifest"); - cleanCache("http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/updatingManifest.sjs"); + cleanCache("https://example.com/tests/dom/tests/mochitest/ajax/offline/simpleManifest.cacheManifest"); + cleanCache("https://example.com/tests/dom/tests/mochitest/ajax/offline/updatingManifest.sjs"); SimpleTest.finish(); }); diff --git a/dom/tests/mochitest/ajax/offline/test_bug474696.html b/dom/tests/mochitest/ajax/offline/test_bug474696.html index 47b0b52023ec..a2e18192c94f 100644 --- a/dom/tests/mochitest/ajax/offline/test_bug474696.html +++ b/dom/tests/mochitest/ajax/offline/test_bug474696.html @@ -1,4 +1,4 @@ - + Fallback on different origin redirect test @@ -7,9 +7,11 @@ + diff --git a/toolkit/components/payments/docs/index.rst b/toolkit/components/payments/docs/index.rst index b52712c9d1d8..8eff97158f8f 100644 --- a/toolkit/components/payments/docs/index.rst +++ b/toolkit/components/payments/docs/index.rst @@ -9,18 +9,38 @@ JSDoc style comments are used within the JS files of the component. This documen .. toctree:: :maxdepth: 5 -Debugging -========= -Set the pref ``dom.payments.loglevel`` to "Debug". +Debugging/Development +===================== -To open a debugger in the context of the remote payment frame, run the following while the dialog is the most recent window:: +Logging +------- - gDevToolsBrowser.openContentProcessToolbox({ - selectedBrowser: Services.wm.getMostRecentWindow(null).document.getElementById("paymentRequestFrame").frameLoader, - }) +Set the pref ``dom.payments.loglevel`` to "Debug" to increase the verbosity of console messages. -To open the debugging console in the dialog, use the keyboard shortcut **Ctrl-Alt-d (Ctrl-Option-d on macOS)**. +Unprivileged UI Development +--------------------------- +During development of the unprivileged custom elements, you can load the dialog over a file: URI or +local server without even requiring a build. Simply load +`toolkit/components/payments/res/paymentRequest.xhtml` in the browser. Use the debugging console to +load sample data. + +Debugging Console +----------------- + +To open the debugging console in the dialog, use the keyboard shortcut +**Ctrl-Alt-d (Ctrl-Option-d on macOS)**. While loading `paymentRequest.xhtml` directly in the +browser, add `?debug=1` to have the debugging console open by default. + +Debugging the unprivileged frame with the developer tools +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +To open a debugger in the context of the remote payment frame, click the "Debug frame" button in the +debugging console. + +Use the `tabs` variable in the Browser Content Toolbox's console to access the frame contents. +There can be multiple frames loaded in the same process so you will need to find the correct tab +in the array by checking the file name is `paymentRequest.xhtml` (e.g. `tabs[0].content.location`). Communication with the DOM @@ -33,7 +53,7 @@ The UI talks to the DOM code via the ``nsIPaymentRequestService`` interface. Dialog Architecture =================== -Privileged wrapper XHTML document (paymentDialog.xhtml) containing a remote ``