author | Tim Huang <tihuang@mozilla.com> |
Thu, 13 Oct 2016 15:43:54 +0800 | |
changeset 317843 | 4639ff15be811f874da20838f8102067ada62a49 |
parent 317842 | 3e153a5acd3597633d67532c4bca294e90ea75aa |
child 317844 | 5480dde6c54e6c4b2a2d1aa1d85ce8bb3d666e04 |
push id | 33170 |
push user | cbook@mozilla.com |
push date | Fri, 14 Oct 2016 10:37:07 +0000 |
treeherder | autoland@0d101ebfd95c [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | ckerschb |
bugs | 1277803 |
milestone | 52.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/browser/components/contextualidentity/test/browser/browser_favicon.js +++ b/browser/components/contextualidentity/test/browser/browser_favicon.js @@ -17,17 +17,17 @@ let gHttpServer = null; let gUserContextId; let gFaviconData; function getIconFile() { new Promise(resolve => { NetUtil.asyncFetch({ uri: "http://www.example.com/browser/browser/components/contextualidentity/test/browser/favicon-normal32.png", loadUsingSystemPrincipal: true, - contentPolicyType: Ci.nsIContentPolicy.TYPE_INTERNAL_IMAGE + contentPolicyType: Ci.nsIContentPolicy.TYPE_INTERNAL_IMAGE_FAVICON }, function(inputStream, status) { let size = inputStream.available(); gFaviconData = NetUtil.readInputStreamToString(inputStream, size); resolve(); }); }); }
--- a/dom/base/nsContentPolicyUtils.h +++ b/dom/base/nsContentPolicyUtils.h @@ -126,16 +126,17 @@ NS_CP_ContentTypeName(uint32_t contentTy CASE_RETURN( TYPE_INTERNAL_VIDEO ); CASE_RETURN( TYPE_INTERNAL_TRACK ); CASE_RETURN( TYPE_INTERNAL_XMLHTTPREQUEST ); CASE_RETURN( TYPE_INTERNAL_EVENTSOURCE ); CASE_RETURN( TYPE_INTERNAL_SERVICE_WORKER ); CASE_RETURN( TYPE_INTERNAL_SCRIPT_PRELOAD ); CASE_RETURN( TYPE_INTERNAL_IMAGE ); CASE_RETURN( TYPE_INTERNAL_IMAGE_PRELOAD ); + CASE_RETURN( TYPE_INTERNAL_IMAGE_FAVICON ); CASE_RETURN( TYPE_INTERNAL_STYLESHEET ); CASE_RETURN( TYPE_INTERNAL_STYLESHEET_PRELOAD ); default: return "<Unknown Type>"; } } #undef CASE_RETURN
--- a/dom/base/nsContentUtils.cpp +++ b/dom/base/nsContentUtils.cpp @@ -8413,16 +8413,17 @@ nsContentUtils::InternalContentPolicyTyp return nsIContentPolicy::TYPE_MEDIA; case nsIContentPolicy::TYPE_INTERNAL_XMLHTTPREQUEST: case nsIContentPolicy::TYPE_INTERNAL_EVENTSOURCE: return nsIContentPolicy::TYPE_XMLHTTPREQUEST; case nsIContentPolicy::TYPE_INTERNAL_IMAGE: case nsIContentPolicy::TYPE_INTERNAL_IMAGE_PRELOAD: + case nsIContentPolicy::TYPE_INTERNAL_IMAGE_FAVICON: return nsIContentPolicy::TYPE_IMAGE; case nsIContentPolicy::TYPE_INTERNAL_STYLESHEET: case nsIContentPolicy::TYPE_INTERNAL_STYLESHEET_PRELOAD: return nsIContentPolicy::TYPE_STYLESHEET; default: return aType;
--- a/dom/base/nsIContentPolicyBase.idl +++ b/dom/base/nsIContentPolicyBase.idl @@ -316,16 +316,24 @@ interface nsIContentPolicyBase : nsISupp /** * Indicates an internal constant for *preloaded* stylesheets. * * This will be mapped to TYPE_STYLESHEET before being passed * to content policy implementations. */ const nsContentPolicyType TYPE_INTERNAL_STYLESHEET_PRELOAD = 40; + /** + * Indicates an internal constant for favicon. + * + * This will be mapped to TYPE_IMAGE before being passed + * to content policy implementations. + */ + const nsContentPolicyType TYPE_INTERNAL_IMAGE_FAVICON = 41; + /* 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. */ //////////////////////////////////////////////////////////////////////
--- a/dom/cache/DBSchema.cpp +++ b/dom/cache/DBSchema.cpp @@ -287,17 +287,18 @@ static_assert(nsIContentPolicy::TYPE_INV nsIContentPolicy::TYPE_INTERNAL_TRACK == 32 && nsIContentPolicy::TYPE_INTERNAL_XMLHTTPREQUEST == 33 && nsIContentPolicy::TYPE_INTERNAL_EVENTSOURCE == 34 && nsIContentPolicy::TYPE_INTERNAL_SERVICE_WORKER == 35 && nsIContentPolicy::TYPE_INTERNAL_SCRIPT_PRELOAD == 36 && nsIContentPolicy::TYPE_INTERNAL_IMAGE == 37 && nsIContentPolicy::TYPE_INTERNAL_IMAGE_PRELOAD == 38 && nsIContentPolicy::TYPE_INTERNAL_STYLESHEET == 39 && - nsIContentPolicy::TYPE_INTERNAL_STYLESHEET_PRELOAD == 40, + nsIContentPolicy::TYPE_INTERNAL_STYLESHEET_PRELOAD == 40 && + nsIContentPolicy::TYPE_INTERNAL_IMAGE_FAVICON == 41, "nsContentPolicyType values are as expected"); namespace { typedef int32_t EntryId; struct IdCount {
--- a/dom/fetch/InternalRequest.cpp +++ b/dom/fetch/InternalRequest.cpp @@ -176,16 +176,17 @@ InternalRequest::MapContentPolicyTypeToR case nsIContentPolicy::TYPE_INTERNAL_WORKER: context = RequestContext::Worker; break; case nsIContentPolicy::TYPE_INTERNAL_SHARED_WORKER: context = RequestContext::Sharedworker; break; case nsIContentPolicy::TYPE_INTERNAL_IMAGE: case nsIContentPolicy::TYPE_INTERNAL_IMAGE_PRELOAD: + case nsIContentPolicy::TYPE_INTERNAL_IMAGE_FAVICON: context = RequestContext::Image; break; case nsIContentPolicy::TYPE_INTERNAL_STYLESHEET: case nsIContentPolicy::TYPE_INTERNAL_STYLESHEET_PRELOAD: context = RequestContext::Style; break; case nsIContentPolicy::TYPE_INTERNAL_OBJECT: context = RequestContext::Object;
--- a/dom/fetch/InternalRequest.h +++ b/dom/fetch/InternalRequest.h @@ -40,17 +40,17 @@ namespace dom { * eventsource | * favicon | * fetch | TYPE_FETCH * font | TYPE_FONT * form | * frame | TYPE_INTERNAL_FRAME * hyperlink | * iframe | TYPE_INTERNAL_IFRAME - * image | TYPE_INTERNAL_IMAGE, TYPE_INTERNAL_IMAGE_PRELOAD + * 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 * location | * manifest | TYPE_WEB_MANIFEST * object | TYPE_INTERNAL_OBJECT * ping | TYPE_PING * plugin | TYPE_OBJECT_SUBREQUEST
--- a/dom/security/nsContentSecurityManager.cpp +++ b/dom/security/nsContentSecurityManager.cpp @@ -46,16 +46,17 @@ static bool SchemeIs(nsIURI* aURI, const static bool IsImageLoadInEditorAppType(nsILoadInfo* aLoadInfo) { // Editor apps get special treatment here, editors can load images // from anywhere. This allows editor to insert images from file:// // into documents that are being edited. nsContentPolicyType type = aLoadInfo->InternalContentPolicyType(); if (type != nsIContentPolicy::TYPE_INTERNAL_IMAGE && type != nsIContentPolicy::TYPE_INTERNAL_IMAGE_PRELOAD && + type != nsIContentPolicy::TYPE_INTERNAL_IMAGE_FAVICON && type != nsIContentPolicy::TYPE_IMAGESET) { return false; } uint32_t appType = nsIDocShell::APP_TYPE_UNKNOWN; nsINode* node = aLoadInfo->LoadingNode(); if (!node) { return false;
--- a/toolkit/components/places/FaviconHelpers.cpp +++ b/toolkit/components/places/FaviconHelpers.cpp @@ -417,17 +417,17 @@ AsyncFetchAndSetIconForPage::FetchFromNe NS_ENSURE_SUCCESS(rv, rv); nsCOMPtr<nsIChannel> channel; rv = NS_NewChannel(getter_AddRefs(channel), iconURI, mLoadingPrincipal, nsILoadInfo::SEC_ALLOW_CROSS_ORIGIN_DATA_INHERITS | nsILoadInfo::SEC_ALLOW_CHROME | nsILoadInfo::SEC_DISALLOW_SCRIPT, - nsIContentPolicy::TYPE_INTERNAL_IMAGE); + nsIContentPolicy::TYPE_INTERNAL_IMAGE_FAVICON); NS_ENSURE_SUCCESS(rv, rv); nsCOMPtr<nsIInterfaceRequestor> listenerRequestor = do_QueryInterface(reinterpret_cast<nsISupports*>(this)); NS_ENSURE_STATE(listenerRequestor); rv = channel->SetNotificationCallbacks(listenerRequestor); NS_ENSURE_SUCCESS(rv, rv); nsCOMPtr<nsIPrivateBrowsingChannel> pbChannel = do_QueryInterface(channel);
--- a/toolkit/components/places/nsFaviconService.cpp +++ b/toolkit/components/places/nsFaviconService.cpp @@ -408,17 +408,17 @@ nsFaviconService::ReplaceFaviconDataFrom nsCOMPtr<nsILoadInfo> loadInfo = new mozilla::LoadInfo(loadingPrincipal, nullptr, // aTriggeringPrincipal nullptr, // aLoadingNode nsILoadInfo::SEC_ALLOW_CROSS_ORIGIN_DATA_INHERITS | nsILoadInfo::SEC_ALLOW_CHROME | nsILoadInfo::SEC_DISALLOW_SCRIPT, - nsIContentPolicy::TYPE_INTERNAL_IMAGE); + nsIContentPolicy::TYPE_INTERNAL_IMAGE_FAVICON); nsCOMPtr<nsIChannel> channel; rv = protocolHandler->NewChannel2(dataURI, loadInfo, getter_AddRefs(channel)); NS_ENSURE_SUCCESS(rv, rv); // Blocking stream is OK for data URIs. nsCOMPtr<nsIInputStream> stream; rv = channel->Open2(getter_AddRefs(stream));
--- a/toolkit/components/places/tests/browser/browser_favicon_setAndFetchFaviconForPage.js +++ b/toolkit/components/places/tests/browser/browser_favicon_setAndFetchFaviconForPage.js @@ -28,17 +28,17 @@ function test() { aWin.close(); }); }); function getIconFile(aCallback) { NetUtil.asyncFetch({ uri: favIconLocation, loadUsingSystemPrincipal: true, - contentPolicyType: Ci.nsIContentPolicy.TYPE_INTERNAL_IMAGE + contentPolicyType: Ci.nsIContentPolicy.TYPE_INTERNAL_IMAGE_FAVICON }, function(inputStream, status) { if (!Components.isSuccessCode(status)) { ok(false, "Could not get the icon file"); // Handle error. return; } // Check the returned size versus the expected size.
--- a/toolkit/components/places/tests/favicons/test_moz-anno_favicon_mime_type.js +++ b/toolkit/components/places/tests/favicons/test_moz-anno_favicon_mime_type.js @@ -57,39 +57,39 @@ function run_test() getService(Ci.nsIFaviconService); let ios = Cc["@mozilla.org/network/io-service;1"]. getService(Ci.nsIIOService); // Test that the default icon has the content type of image/png. let channel = NetUtil.newChannel({ uri: fs.defaultFavicon, loadUsingSystemPrincipal: true, - contentPolicyType: Ci.nsIContentPolicy.TYPE_INTERNAL_IMAGE + contentPolicyType: Ci.nsIContentPolicy.TYPE_INTERNAL_IMAGE_FAVICON }); channel.asyncOpen2(new streamListener("image/png")); do_test_pending(); // Test URI that we don't know anything about. Will end up being the default // icon, so expect image/png. channel = NetUtil.newChannel({ uri: moz_anno_favicon_prefix + "http://mozilla.org", loadUsingSystemPrincipal: true, - contentPolicyType: Ci.nsIContentPolicy.TYPE_INTERNAL_IMAGE + contentPolicyType: Ci.nsIContentPolicy.TYPE_INTERNAL_IMAGE_FAVICON }); channel.asyncOpen2(new streamListener("image/png")); do_test_pending(); // Test that the content type of a favicon we add ends up being image/png. let testURI = uri("http://mozilla.org/"); // Add the data before opening fs.replaceFaviconDataFromDataURL(testURI, testFaviconData, (Date.now() + 60 * 60 * 24 * 1000) * 1000, Services.scriptSecurityManager.getSystemPrincipal()); // Open the channel channel = NetUtil.newChannel({ uri: moz_anno_favicon_prefix + testURI.spec, loadUsingSystemPrincipal: true, - contentPolicyType: Ci.nsIContentPolicy.TYPE_INTERNAL_IMAGE + contentPolicyType: Ci.nsIContentPolicy.TYPE_INTERNAL_IMAGE_FAVICON }); channel.asyncOpen2(new streamListener("image/png")); do_test_pending(); }
--- a/toolkit/components/places/tests/favicons/test_page-icon_protocol.js +++ b/toolkit/components/places/tests/favicons/test_page-icon_protocol.js @@ -2,17 +2,17 @@ const ICON_DATA = "data:image/png;base64 const TEST_URI = NetUtil.newURI("http://mozilla.org/"); const ICON_URI = NetUtil.newURI("http://mozilla.org/favicon.ico"); function fetchIconForSpec(spec) { return new Promise((resolve, reject) => { NetUtil.asyncFetch({ uri: NetUtil.newURI("page-icon:" + TEST_URI.spec), loadUsingSystemPrincipal: true, - contentPolicyType: Ci.nsIContentPolicy.TYPE_INTERNAL_IMAGE + contentPolicyType: Ci.nsIContentPolicy.TYPE_INTERNAL_IMAGE_FAVICON }, (input, status, request) => { if (!Components.isSuccessCode(status)) { reject(new Error("unable to load icon")); return; } try { let data = NetUtil.readInputStreamToString(input, input.available());