Allow the loading of TYPE_FONT from file: URLs.

This commit is contained in:
Fedor 2019-09-05 20:09:35 +03:00
parent aee84ebc64
commit 1f57f45f54
5 changed files with 28 additions and 7 deletions

View File

@ -461,7 +461,11 @@ PlacesController.prototype = {
if (parentNode) {
if (PlacesUtils.nodeIsTagQuery(parentNode))
nodeData["tagChild"] = true;
else if (this.hasCachedLivemarkInfo(parentNode))
}
} else {
var parentNode = node.parent;
if (parentNode) {
if (this.hasCachedLivemarkInfo(parentNode))
nodeData["livemarkChild"] = true;
}
}

View File

@ -198,7 +198,7 @@
accesskey="&cmd.delete.accesskey;"
closemenu="single"
selection="link"
forcehideselection="bookmark"/>
forcehideselection="bookmark|livemarkChild"/>
<menuitem id="placesContext_deleteHost"
command="placesCmd_deleteDataHost"
label="&cmd.deleteDomainData.label;"
@ -207,7 +207,7 @@
selection="link|host"
selectiontype="single"
hideifprivatebrowsing="true"
forcehideselection="bookmark"/>
forcehideselection="bookmark|livemarkChild"/>
<menuseparator id="placesContext_deleteSeparator"/>
<menuitem id="placesContext_sortBy:name"
command="placesCmd_sortBy:name"

View File

@ -444,7 +444,11 @@ PlacesController.prototype = {
if (parentNode) {
if (PlacesUtils.nodeIsTagQuery(parentNode))
nodeData["tagChild"] = true;
else if (this.hasCachedLivemarkInfo(parentNode))
}
} else {
var parentNode = node.parent;
if (parentNode) {
if (this.hasCachedLivemarkInfo(parentNode))
nodeData["livemarkChild"] = true;
}
}

View File

@ -203,7 +203,7 @@
accesskey="&cmd.delete.accesskey;"
closemenu="single"
selection="link"
forcehideselection="bookmark"/>
forcehideselection="bookmark|livemarkChild"/>
<menuitem id="placesContext_deleteHost"
command="placesCmd_deleteDataHost"
label="&cmd.deleteDomainData.label;"
@ -212,7 +212,7 @@
selection="link|host"
selectiontype="single"
hideifprivatebrowsing="true"
forcehideselection="bookmark"/>
forcehideselection="bookmark|livemarkChild"/>
<menuseparator id="placesContext_deleteSeparator"/>
<menuitem id="placesContext_reload"
command="placesCmd_reload"

View File

@ -583,6 +583,19 @@ FontFaceSet::StartLoad(gfxUserFontEntry* aUserFontEntry,
nsCOMPtr<nsIStreamLoader> streamLoader;
nsCOMPtr<nsILoadGroup> loadGroup(mDocument->GetDocumentLoadGroup());
// We're determining the security flags for font loading here based on
// scheme, because we want to allow fonts to be loaded using file:
// even if unique origins for file: access is enforced (allow CORS
// bypass in this case).
uint32_t securityFlags = 0;
bool isFile = false;
if (NS_SUCCEEDED(aFontFaceSrc->mURI->SchemeIs("file", &isFile)) &&
isFile) {
securityFlags = nsILoadInfo::SEC_ALLOW_CROSS_ORIGIN_DATA_INHERITS;
} else {
securityFlags = nsILoadInfo::SEC_REQUIRE_CORS_DATA_INHERITS;
}
nsCOMPtr<nsIChannel> channel;
// Note we are calling NS_NewChannelWithTriggeringPrincipal() with both a
// node and a principal. This is because the document where the font is
@ -592,7 +605,7 @@ FontFaceSet::StartLoad(gfxUserFontEntry* aUserFontEntry,
aFontFaceSrc->mURI,
mDocument,
aUserFontEntry->GetPrincipal(),
nsILoadInfo::SEC_REQUIRE_CORS_DATA_INHERITS,
securityFlags,
nsIContentPolicy::TYPE_FONT,
loadGroup);
NS_ENSURE_SUCCESS(rv, rv);