From 1f6068bc695b8bee56f0a99e4343ff138b1ee188 Mon Sep 17 00:00:00 2001 From: janekptacijarabaci Date: Sun, 17 Jun 2018 09:29:53 +0200 Subject: Bug 1398229 - Save-link-as feature should use the loading principal - context menu using nsIContentPolicy.TYPE_SAVE_AS_DOWNLOAD --- application/basilisk/base/content/nsContextMenu.js | 4 +++- application/palemoon/base/content/nsContextMenu.js | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/application/basilisk/base/content/nsContextMenu.js b/application/basilisk/base/content/nsContextMenu.js index 097caf367..31fa4e761 100644 --- a/application/basilisk/base/content/nsContextMenu.js +++ b/application/basilisk/base/content/nsContextMenu.js @@ -1355,7 +1355,9 @@ nsContextMenu.prototype = { // checks after redirects, see bug: 1136055 var channel = NetUtil.newChannel({ uri: makeURI(linkURL), - loadUsingSystemPrincipal: true + loadingPrincipal: this.principal, + contentPolicyType: Ci.nsIContentPolicy.TYPE_SAVEAS_DOWNLOAD, + securityFlags: Ci.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_DATA_INHERITS, }); if (linkDownload) diff --git a/application/palemoon/base/content/nsContextMenu.js b/application/palemoon/base/content/nsContextMenu.js index f389491d3..bd8bf9c85 100644 --- a/application/palemoon/base/content/nsContextMenu.js +++ b/application/palemoon/base/content/nsContextMenu.js @@ -1131,7 +1131,9 @@ nsContextMenu.prototype = { // checks after redirects, see bug: 1136055 var channel = NetUtil.newChannel({ uri: makeURI(linkURL), - loadUsingSystemPrincipal: true + loadingPrincipal: this.principal, + contentPolicyType: Ci.nsIContentPolicy.TYPE_SAVEAS_DOWNLOAD, + securityFlags: Ci.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_DATA_INHERITS, }); if (linkDownload) -- cgit v1.2.3 From 07ee0792c9664d649fae8ae530b27462ee45f530 Mon Sep 17 00:00:00 2001 From: janekptacijarabaci Date: Sun, 17 Jun 2018 09:35:48 +0200 Subject: Bug 1398229 - Save-link-as feature should use the loading principal - implementation of nsIContentPolicy.TYPE_SAVE_AS_DOWNLOAD --- dom/base/nsContentPolicyUtils.h | 3 ++- dom/base/nsIContentPolicyBase.idl | 5 +++++ dom/cache/DBSchema.cpp | 1 + dom/fetch/InternalRequest.cpp | 3 +++ dom/fetch/InternalRequest.h | 2 +- dom/security/nsContentSecurityManager.cpp | 6 ++++++ dom/security/nsMixedContentBlocker.cpp | 7 +++++++ 7 files changed, 25 insertions(+), 2 deletions(-) diff --git a/dom/base/nsContentPolicyUtils.h b/dom/base/nsContentPolicyUtils.h index ed0544226..f530f9be9 100644 --- a/dom/base/nsContentPolicyUtils.h +++ b/dom/base/nsContentPolicyUtils.h @@ -115,6 +115,7 @@ NS_CP_ContentTypeName(uint32_t contentType) CASE_RETURN( TYPE_FETCH ); CASE_RETURN( TYPE_IMAGESET ); CASE_RETURN( TYPE_WEB_MANIFEST ); + CASE_RETURN( TYPE_SAVEAS_DOWNLOAD ); CASE_RETURN( TYPE_INTERNAL_SCRIPT ); CASE_RETURN( TYPE_INTERNAL_WORKER ); CASE_RETURN( TYPE_INTERNAL_SHARED_WORKER ); @@ -236,7 +237,7 @@ NS_CheckContentLoadPolicy(uint32_t contentType, CHECK_PRINCIPAL_AND_DATA(ShouldLoad); if (policyService) { CHECK_CONTENT_POLICY_WITH_SERVICE(ShouldLoad, policyService); - } +y ? CHECK_CONTENT_POLICY(ShouldLoad); } diff --git a/dom/base/nsIContentPolicyBase.idl b/dom/base/nsIContentPolicyBase.idl index 884e3d96d..0520ebacc 100644 --- a/dom/base/nsIContentPolicyBase.idl +++ b/dom/base/nsIContentPolicyBase.idl @@ -181,6 +181,11 @@ interface nsIContentPolicyBase : nsISupports */ const nsContentPolicyType TYPE_WEB_MANIFEST = 22; + /** + * Indicates an save-as link download from the front-end code. + */ + const nsContentPolicyType TYPE_SAVEAS_DOWNLOAD = 43; + /** * Indicates an internal constant for scripts loaded through script * elements. diff --git a/dom/cache/DBSchema.cpp b/dom/cache/DBSchema.cpp index d16ba2d6a..975fe8742 100644 --- a/dom/cache/DBSchema.cpp +++ b/dom/cache/DBSchema.cpp @@ -269,6 +269,7 @@ static_assert(nsIContentPolicy::TYPE_INVALID == 0 && nsIContentPolicy::TYPE_FETCH == 20 && nsIContentPolicy::TYPE_IMAGESET == 21 && nsIContentPolicy::TYPE_WEB_MANIFEST == 22 && + nsIContentPolicy::TYPE_SAVEAS_DOWNLOAD == 43 && nsIContentPolicy::TYPE_INTERNAL_SCRIPT == 23 && nsIContentPolicy::TYPE_INTERNAL_WORKER == 24 && nsIContentPolicy::TYPE_INTERNAL_SHARED_WORKER == 25 && diff --git a/dom/fetch/InternalRequest.cpp b/dom/fetch/InternalRequest.cpp index 85feabde3..b2631da6a 100644 --- a/dom/fetch/InternalRequest.cpp +++ b/dom/fetch/InternalRequest.cpp @@ -320,6 +320,9 @@ InternalRequest::MapContentPolicyTypeToRequestContext(nsContentPolicyType aConte case nsIContentPolicy::TYPE_WEB_MANIFEST: context = RequestContext::Manifest; break; + case nsIContentPolicy::TYPE_SAVEAS_DOWNLOAD: + context = RequestContext::Internal; + break; default: MOZ_ASSERT(false, "Unhandled nsContentPolicyType value"); break; diff --git a/dom/fetch/InternalRequest.h b/dom/fetch/InternalRequest.h index 84ee0bf69..966490675 100644 --- a/dom/fetch/InternalRequest.h +++ b/dom/fetch/InternalRequest.h @@ -53,7 +53,7 @@ namespace dom { * image | TYPE_INTERNAL_IMAGE, TYPE_INTERNAL_IMAGE_PRELOAD, TYPE_INTERNAL_IMAGE_FAVICON * imageset | TYPE_IMAGESET * import | Not supported by Gecko - * internal | TYPE_DOCUMENT, TYPE_XBL, TYPE_OTHER + * internal | TYPE_DOCUMENT, TYPE_XBL, TYPE_OTHER, TYPE_SAVEAS_DOWNLOAD * location | * manifest | TYPE_WEB_MANIFEST * object | TYPE_INTERNAL_OBJECT diff --git a/dom/security/nsContentSecurityManager.cpp b/dom/security/nsContentSecurityManager.cpp index f329aa723..4ee9b4877 100644 --- a/dom/security/nsContentSecurityManager.cpp +++ b/dom/security/nsContentSecurityManager.cpp @@ -471,6 +471,12 @@ DoContentSecurityChecks(nsIChannel* aChannel, nsILoadInfo* aLoadInfo) break; } + case nsIContentPolicy::TYPE_SAVEAS_DOWNLOAD: { + mimeTypeGuess = EmptyCString(); + requestingContext = aLoadInfo->LoadingNode(); + break; + } + default: // nsIContentPolicy::TYPE_INVALID MOZ_ASSERT(false, "can not perform security check without a valid contentType"); diff --git a/dom/security/nsMixedContentBlocker.cpp b/dom/security/nsMixedContentBlocker.cpp index 7d50a43a3..c03628da0 100644 --- a/dom/security/nsMixedContentBlocker.cpp +++ b/dom/security/nsMixedContentBlocker.cpp @@ -468,6 +468,13 @@ nsMixedContentBlocker::ShouldLoad(bool aHadInsecureImageRedirect, *aDecision = ACCEPT; return NS_OK; + // Creating insecure connections for a save-as link download is acceptable. + // This download is completely disconnected from the docShell, but still + // using the same loading principal. + case TYPE_SAVEAS_DOWNLOAD: + *aDecision = ACCEPT; + return NS_OK; + // Static display content is considered moderate risk for mixed content so // these will be blocked according to the mixed display preference case TYPE_IMAGE: -- cgit v1.2.3 From bf9d01df16a703aa106c56c449980b45a47b0913 Mon Sep 17 00:00:00 2001 From: janekptacijarabaci Date: Sun, 17 Jun 2018 09:43:40 +0200 Subject: Bug 1430758 - No CSP directive for nsIContentPolicy::TYPE_SAVEAS_DOWNLOAD --- dom/security/nsCSPUtils.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dom/security/nsCSPUtils.cpp b/dom/security/nsCSPUtils.cpp index 49832f8f4..71c8e3433 100644 --- a/dom/security/nsCSPUtils.cpp +++ b/dom/security/nsCSPUtils.cpp @@ -258,6 +258,9 @@ CSP_ContentTypeToDirective(nsContentPolicyType aType) case nsIContentPolicy::TYPE_CSP_REPORT: return nsIContentSecurityPolicy::NO_DIRECTIVE; + case nsIContentPolicy::TYPE_SAVEAS_DOWNLOAD: + return nsIContentSecurityPolicy::NO_DIRECTIVE; + // Fall through to error for all other directives default: MOZ_ASSERT(false, "Can not map nsContentPolicyType to CSPDirective"); -- cgit v1.2.3 From e357dfa9b1300e736c8c1bbcbff2b93921eb327e Mon Sep 17 00:00:00 2001 From: janekptacijarabaci Date: Sun, 17 Jun 2018 10:12:34 +0200 Subject: Fix typo in nsContentPolicyUtils.h --- dom/base/nsContentPolicyUtils.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dom/base/nsContentPolicyUtils.h b/dom/base/nsContentPolicyUtils.h index f530f9be9..3cef7923e 100644 --- a/dom/base/nsContentPolicyUtils.h +++ b/dom/base/nsContentPolicyUtils.h @@ -237,7 +237,7 @@ NS_CheckContentLoadPolicy(uint32_t contentType, CHECK_PRINCIPAL_AND_DATA(ShouldLoad); if (policyService) { CHECK_CONTENT_POLICY_WITH_SERVICE(ShouldLoad, policyService); -y ? + } CHECK_CONTENT_POLICY(ShouldLoad); } -- cgit v1.2.3 From 8eb2350e4fb66edf33d13af12023862a9652dd1d Mon Sep 17 00:00:00 2001 From: janekptacijarabaci Date: Sun, 17 Jun 2018 10:32:41 +0200 Subject: Remove a comment in nsContextMenu.js --- application/basilisk/base/content/nsContextMenu.js | 5 ----- application/palemoon/base/content/nsContextMenu.js | 5 ----- 2 files changed, 10 deletions(-) diff --git a/application/basilisk/base/content/nsContextMenu.js b/application/basilisk/base/content/nsContextMenu.js index 31fa4e761..589d670ab 100644 --- a/application/basilisk/base/content/nsContextMenu.js +++ b/application/basilisk/base/content/nsContextMenu.js @@ -1348,11 +1348,6 @@ nsContextMenu.prototype = { } // setting up a new channel for 'right click - save link as ...' - // ideally we should use: - // * doc - as the loadingNode, and/or - // * this.principal - as the loadingPrincipal - // for now lets use systemPrincipal to bypass mixedContentBlocker - // checks after redirects, see bug: 1136055 var channel = NetUtil.newChannel({ uri: makeURI(linkURL), loadingPrincipal: this.principal, diff --git a/application/palemoon/base/content/nsContextMenu.js b/application/palemoon/base/content/nsContextMenu.js index bd8bf9c85..2a794c5f2 100644 --- a/application/palemoon/base/content/nsContextMenu.js +++ b/application/palemoon/base/content/nsContextMenu.js @@ -1124,11 +1124,6 @@ nsContextMenu.prototype = { } // setting up a new channel for 'right click - save link as ...' - // ideally we should use: - // * doc - as the loadingNode, and/or - // * this.principal - as the loadingPrincipal - // for now lets use systemPrincipal to bypass mixedContentBlocker - // checks after redirects, see bug: 1136055 var channel = NetUtil.newChannel({ uri: makeURI(linkURL), loadingPrincipal: this.principal, -- cgit v1.2.3 From 3cf5a826006477aec57e428a216d317cec1c9ca0 Mon Sep 17 00:00:00 2001 From: janekptacijarabaci Date: Sun, 17 Jun 2018 13:14:07 +0200 Subject: [PALEMOON] Fix "loadingPrincipal" in nsContextMenu.js --- application/palemoon/base/content/nsContextMenu.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/palemoon/base/content/nsContextMenu.js b/application/palemoon/base/content/nsContextMenu.js index 2a794c5f2..738868ccb 100644 --- a/application/palemoon/base/content/nsContextMenu.js +++ b/application/palemoon/base/content/nsContextMenu.js @@ -1126,7 +1126,7 @@ nsContextMenu.prototype = { // setting up a new channel for 'right click - save link as ...' var channel = NetUtil.newChannel({ uri: makeURI(linkURL), - loadingPrincipal: this.principal, + loadingPrincipal: this.target.ownerDocument.nodePrincipal, contentPolicyType: Ci.nsIContentPolicy.TYPE_SAVEAS_DOWNLOAD, securityFlags: Ci.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_DATA_INHERITS, }); -- cgit v1.2.3 From 6dd31012f0948af8334a730681421e0efb32cdf0 Mon Sep 17 00:00:00 2001 From: janekptacijarabaci Date: Sun, 17 Jun 2018 14:15:53 +0200 Subject: Rewrite uuid for ContentPolicy --- dom/base/nsIContentPolicy.idl | 2 +- dom/base/nsIContentPolicyBase.idl | 2 +- dom/base/nsISimpleContentPolicy.idl | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dom/base/nsIContentPolicy.idl b/dom/base/nsIContentPolicy.idl index a73565a9a..efb0a30a3 100644 --- a/dom/base/nsIContentPolicy.idl +++ b/dom/base/nsIContentPolicy.idl @@ -20,7 +20,7 @@ interface nsIPrincipal; * by launching a dialog to prompt the user for something). */ -[scriptable,uuid(caad4f1f-d047-46ac-ae9d-dc598e4fb91b)] +[scriptable,uuid(d472863b-adb2-4448-aa8f-6c33c0c4c633)] interface nsIContentPolicy : nsIContentPolicyBase { /** diff --git a/dom/base/nsIContentPolicyBase.idl b/dom/base/nsIContentPolicyBase.idl index 0520ebacc..01c1d803c 100644 --- a/dom/base/nsIContentPolicyBase.idl +++ b/dom/base/nsIContentPolicyBase.idl @@ -24,7 +24,7 @@ typedef unsigned long nsContentPolicyType; * by launching a dialog to prompt the user for something). */ -[scriptable,uuid(17418187-d86f-48dd-92d1-238838df0a4e)] +[scriptable,uuid(e8046cd0-3b32-4065-ad78-4099a9bb2e35)] interface nsIContentPolicyBase : nsISupports { /** diff --git a/dom/base/nsISimpleContentPolicy.idl b/dom/base/nsISimpleContentPolicy.idl index 493aee1a5..ad1e3d897 100644 --- a/dom/base/nsISimpleContentPolicy.idl +++ b/dom/base/nsISimpleContentPolicy.idl @@ -28,7 +28,7 @@ interface nsIDOMElement; * by launching a dialog to prompt the user for something). */ -[scriptable,uuid(b9df71e3-a9b3-4706-b2d5-e6c0d3d68ec7)] +[scriptable,uuid(2215d135-df0d-445b-bb49-f11a4855f2a1)] interface nsISimpleContentPolicy : nsIContentPolicyBase { /** -- cgit v1.2.3 From 6e567403cb5d8e7732180c920e5c7d99339bc8c7 Mon Sep 17 00:00:00 2001 From: janekptacijarabaci Date: Sun, 17 Jun 2018 14:20:50 +0200 Subject: Added Ci.nsIContentPolicy.TYPE_SAVEAS_DOWNLOAD to next files --- devtools/client/netmonitor/request-utils.js | 3 ++- extensions/permissions/nsContentBlocker.cpp | 1 + toolkit/modules/addons/WebRequestCommon.jsm | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/devtools/client/netmonitor/request-utils.js b/devtools/client/netmonitor/request-utils.js index 647d71e7c..90fb0c957 100644 --- a/devtools/client/netmonitor/request-utils.js +++ b/devtools/client/netmonitor/request-utils.js @@ -177,7 +177,8 @@ const LOAD_CAUSE_STRINGS = { [Ci.nsIContentPolicy.TYPE_BEACON]: "beacon", [Ci.nsIContentPolicy.TYPE_FETCH]: "fetch", [Ci.nsIContentPolicy.TYPE_IMAGESET]: "imageset", - [Ci.nsIContentPolicy.TYPE_WEB_MANIFEST]: "webManifest" + [Ci.nsIContentPolicy.TYPE_WEB_MANIFEST]: "webManifest", + [Ci.nsIContentPolicy.TYPE_SAVEAS_DOWNLOAD]: "saveasDownload" }; exports.loadCauseString = function (causeType) { diff --git a/extensions/permissions/nsContentBlocker.cpp b/extensions/permissions/nsContentBlocker.cpp index cc2162b70..278ec21a0 100644 --- a/extensions/permissions/nsContentBlocker.cpp +++ b/extensions/permissions/nsContentBlocker.cpp @@ -46,6 +46,7 @@ static const char *kTypeString[] = { "fetch", "image", "manifest", + "saveas_download", "", // TYPE_INTERNAL_SCRIPT "", // TYPE_INTERNAL_WORKER "", // TYPE_INTERNAL_SHARED_WORKER diff --git a/toolkit/modules/addons/WebRequestCommon.jsm b/toolkit/modules/addons/WebRequestCommon.jsm index 9359f4ff7..5dc860376 100644 --- a/toolkit/modules/addons/WebRequestCommon.jsm +++ b/toolkit/modules/addons/WebRequestCommon.jsm @@ -35,6 +35,7 @@ var WebRequestCommon = { case Ci.nsIContentPolicy.TYPE_CSP_REPORT: return "csp_report"; case Ci.nsIContentPolicy.TYPE_IMAGESET: return "imageset"; case Ci.nsIContentPolicy.TYPE_WEB_MANIFEST: return "web_manifest"; + case Ci.nsIContentPolicy.TYPE_SAVEAS_DOWNLOAD: return "saveas_download"; default: return "other"; } }, -- cgit v1.2.3 From aebdb991f41d3cc864451ce1c09c7b7c691cbe76 Mon Sep 17 00:00:00 2001 From: janekptacijarabaci Date: Mon, 18 Jun 2018 00:49:45 +0200 Subject: nsIContentPolicy: Their order (in nsIContentPolicyBase.idl) must be retained in nsContentBlocker.cpp --- dom/base/nsContentPolicyUtils.h | 2 +- extensions/permissions/nsContentBlocker.cpp | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/dom/base/nsContentPolicyUtils.h b/dom/base/nsContentPolicyUtils.h index 3cef7923e..600b24c56 100644 --- a/dom/base/nsContentPolicyUtils.h +++ b/dom/base/nsContentPolicyUtils.h @@ -115,7 +115,6 @@ NS_CP_ContentTypeName(uint32_t contentType) CASE_RETURN( TYPE_FETCH ); CASE_RETURN( TYPE_IMAGESET ); CASE_RETURN( TYPE_WEB_MANIFEST ); - CASE_RETURN( TYPE_SAVEAS_DOWNLOAD ); CASE_RETURN( TYPE_INTERNAL_SCRIPT ); CASE_RETURN( TYPE_INTERNAL_WORKER ); CASE_RETURN( TYPE_INTERNAL_SHARED_WORKER ); @@ -135,6 +134,7 @@ NS_CP_ContentTypeName(uint32_t contentType) CASE_RETURN( TYPE_INTERNAL_IMAGE_FAVICON ); CASE_RETURN( TYPE_INTERNAL_STYLESHEET ); CASE_RETURN( TYPE_INTERNAL_STYLESHEET_PRELOAD ); + CASE_RETURN( TYPE_SAVEAS_DOWNLOAD ); default: return ""; } diff --git a/extensions/permissions/nsContentBlocker.cpp b/extensions/permissions/nsContentBlocker.cpp index 278ec21a0..391785dc3 100644 --- a/extensions/permissions/nsContentBlocker.cpp +++ b/extensions/permissions/nsContentBlocker.cpp @@ -23,6 +23,7 @@ #define BEHAVIOR_NOFOREIGN 3 // From nsIContentPolicy +// and nsIContentPolicyBase.idl: Their order must be retained! static const char *kTypeString[] = { "other", "script", @@ -46,7 +47,6 @@ static const char *kTypeString[] = { "fetch", "image", "manifest", - "saveas_download", "", // TYPE_INTERNAL_SCRIPT "", // TYPE_INTERNAL_WORKER "", // TYPE_INTERNAL_SHARED_WORKER @@ -60,6 +60,13 @@ static const char *kTypeString[] = { "", // TYPE_INTERNAL_XMLHTTPREQUEST "", // TYPE_INTERNAL_EVENTSOURCE "", // TYPE_INTERNAL_SERVICE_WORKER + "", // TYPE_INTERNAL_SCRIPT_PRELOAD + "", // TYPE_INTERNAL_IMAGE + "", // TYPE_INTERNAL_IMAGE_PRELOAD + "", // TYPE_INTERNAL_STYLESHEET + "", // TYPE_INTERNAL_STYLESHEET_PRELOAD + "", // TYPE_INTERNAL_IMAGE_FAVICON + "saveas_download", }; #define NUMBER_OF_TYPES MOZ_ARRAY_LENGTH(kTypeString) -- cgit v1.2.3 From 22f7e8f8a74ee5ff83a0b76c789d011bd54244b9 Mon Sep 17 00:00:00 2001 From: janekptacijarabaci Date: Mon, 18 Jun 2018 00:52:04 +0200 Subject: nsIContentPolicy: Numbers should not be omitted in nsIContentPolicyBase.idl, rewrite uuid --- dom/base/nsIContentPolicy.idl | 2 +- dom/base/nsIContentPolicyBase.idl | 21 +++++++++++---------- dom/base/nsISimpleContentPolicy.idl | 2 +- dom/cache/DBSchema.cpp | 4 ++-- 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/dom/base/nsIContentPolicy.idl b/dom/base/nsIContentPolicy.idl index efb0a30a3..200b97fbc 100644 --- a/dom/base/nsIContentPolicy.idl +++ b/dom/base/nsIContentPolicy.idl @@ -20,7 +20,7 @@ interface nsIPrincipal; * by launching a dialog to prompt the user for something). */ -[scriptable,uuid(d472863b-adb2-4448-aa8f-6c33c0c4c633)] +[scriptable,uuid(64a5ae16-6836-475c-9938-4b6cc1eee8fb)] interface nsIContentPolicy : nsIContentPolicyBase { /** diff --git a/dom/base/nsIContentPolicyBase.idl b/dom/base/nsIContentPolicyBase.idl index 01c1d803c..908e562a8 100644 --- a/dom/base/nsIContentPolicyBase.idl +++ b/dom/base/nsIContentPolicyBase.idl @@ -24,7 +24,7 @@ typedef unsigned long nsContentPolicyType; * by launching a dialog to prompt the user for something). */ -[scriptable,uuid(e8046cd0-3b32-4065-ad78-4099a9bb2e35)] +[scriptable,uuid(d6ab1d11-8e24-4db4-8582-c40a78281737)] interface nsIContentPolicyBase : nsISupports { /** @@ -181,11 +181,6 @@ interface nsIContentPolicyBase : nsISupports */ const nsContentPolicyType TYPE_WEB_MANIFEST = 22; - /** - * Indicates an save-as link download from the front-end code. - */ - const nsContentPolicyType TYPE_SAVEAS_DOWNLOAD = 43; - /** * Indicates an internal constant for scripts loaded through script * elements. @@ -334,11 +329,17 @@ interface nsIContentPolicyBase : nsISupports */ const nsContentPolicyType TYPE_INTERNAL_IMAGE_FAVICON = 41; + /** + * Indicates an save-as link download from the front-end code. + */ + const nsContentPolicyType TYPE_SAVEAS_DOWNLOAD = 42; + /* When adding new content types, please update nsContentBlocker, - * NS_CP_ContentTypeName, nsCSPContext, all nsIContentPolicy - * implementations, the static_assert in dom/cache/DBSchema.cpp, - * and other things that are not listed here that are related to - * nsIContentPolicy. */ + * NS_CP_ContentTypeName, nsCSPContext, CSP_ContentTypeToDirective, + * DoContentSecurityChecks, all nsIContentPolicy implementations, the + * static_assert in dom/cache/DBSchema.cpp, nsPermissionManager.cpp, + * and other things that are not listed here that are related + * to nsIContentPolicy. */ ////////////////////////////////////////////////////////////////////// diff --git a/dom/base/nsISimpleContentPolicy.idl b/dom/base/nsISimpleContentPolicy.idl index ad1e3d897..dc0474736 100644 --- a/dom/base/nsISimpleContentPolicy.idl +++ b/dom/base/nsISimpleContentPolicy.idl @@ -28,7 +28,7 @@ interface nsIDOMElement; * by launching a dialog to prompt the user for something). */ -[scriptable,uuid(2215d135-df0d-445b-bb49-f11a4855f2a1)] +[scriptable,uuid(1553a476-8a14-410b-8ecc-47f48e937392)] interface nsISimpleContentPolicy : nsIContentPolicyBase { /** diff --git a/dom/cache/DBSchema.cpp b/dom/cache/DBSchema.cpp index 975fe8742..176e7b9d1 100644 --- a/dom/cache/DBSchema.cpp +++ b/dom/cache/DBSchema.cpp @@ -269,7 +269,6 @@ static_assert(nsIContentPolicy::TYPE_INVALID == 0 && nsIContentPolicy::TYPE_FETCH == 20 && nsIContentPolicy::TYPE_IMAGESET == 21 && nsIContentPolicy::TYPE_WEB_MANIFEST == 22 && - nsIContentPolicy::TYPE_SAVEAS_DOWNLOAD == 43 && nsIContentPolicy::TYPE_INTERNAL_SCRIPT == 23 && nsIContentPolicy::TYPE_INTERNAL_WORKER == 24 && nsIContentPolicy::TYPE_INTERNAL_SHARED_WORKER == 25 && @@ -288,7 +287,8 @@ static_assert(nsIContentPolicy::TYPE_INVALID == 0 && nsIContentPolicy::TYPE_INTERNAL_IMAGE_PRELOAD == 38 && nsIContentPolicy::TYPE_INTERNAL_STYLESHEET == 39 && nsIContentPolicy::TYPE_INTERNAL_STYLESHEET_PRELOAD == 40 && - nsIContentPolicy::TYPE_INTERNAL_IMAGE_FAVICON == 41, + nsIContentPolicy::TYPE_INTERNAL_IMAGE_FAVICON == 41 && + nsIContentPolicy::TYPE_SAVEAS_DOWNLOAD == 42, "nsContentPolicyType values are as expected"); namespace { -- cgit v1.2.3