mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-21 06:37:30 +09:00
Issue #2158 - Part 2: Handle and expose preload link destination to DOM
This also defines known preload destinations and ensures it is reflected in JS.
This commit is contained in:
parent
8e1b3db048
commit
24189770aa
11 changed files with 98 additions and 5 deletions
|
|
@ -26,6 +26,47 @@
|
|||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
enum Destination : uint8_t
|
||||
{
|
||||
DESTINATION_INVALID,
|
||||
DESTINATION_AUDIO,
|
||||
DESTINATION_AUDIOWORKLET,
|
||||
DESTINATION_DOCUMENT,
|
||||
DESTINATION_EMBED,
|
||||
DESTINATION_FONT,
|
||||
DESTINATION_FRAME,
|
||||
DESTINATION_IFRAME,
|
||||
DESTINATION_IMAGE,
|
||||
DESTINATION_JSON,
|
||||
DESTINATION_MANIFEST,
|
||||
DESTINATION_OBJECT,
|
||||
DESTINATION_REPORT,
|
||||
DESTINATION_SCRIPT,
|
||||
DESTINATION_SERVICEWORKER,
|
||||
DESTINATION_SHAREDWORKER,
|
||||
DESTINATION_STYLE,
|
||||
DESTINATION_TRACK,
|
||||
DESTINATION_VIDEO,
|
||||
DESTINATION_WEBIDENTITY,
|
||||
DESTINATION_WORKER,
|
||||
DESTINATION_XSLT,
|
||||
DESTINATION_FETCH
|
||||
};
|
||||
|
||||
static const nsAttrValue::EnumTable kDestinationAttributeTable[] = {
|
||||
{ "", DESTINATION_INVALID },
|
||||
{ "audio", DESTINATION_AUDIO },
|
||||
{ "font", DESTINATION_FONT },
|
||||
{ "image", DESTINATION_IMAGE },
|
||||
{ "script", DESTINATION_SCRIPT },
|
||||
{ "style", DESTINATION_STYLE },
|
||||
{ "track", DESTINATION_TRACK },
|
||||
{ "video", DESTINATION_VIDEO },
|
||||
{ "fetch", DESTINATION_FETCH },
|
||||
{ "json", DESTINATION_JSON },
|
||||
{ nullptr, 0 }
|
||||
};
|
||||
|
||||
Link::Link(Element *aElement)
|
||||
: mElement(aElement)
|
||||
, mHistory(services::GetHistoryService())
|
||||
|
|
@ -635,6 +676,17 @@ Link::SetHrefAttribute(nsIURI *aURI)
|
|||
NS_ConvertUTF8toUTF16(href), true);
|
||||
}
|
||||
|
||||
/* static */ void
|
||||
Link::ParseDestinationValue(const nsAString& aValue,
|
||||
nsAttrValue& aResult)
|
||||
{
|
||||
// Invalid values are treated as an empty string.
|
||||
aResult.ParseEnumValue(aValue,
|
||||
kDestinationAttributeTable,
|
||||
false,
|
||||
&kDestinationAttributeTable[0]);
|
||||
}
|
||||
|
||||
size_t
|
||||
Link::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue