mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-12 02:07:33 +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
|
|
@ -471,6 +471,7 @@ nsContentSink::ProcessLinkHeader(const nsAString& aLinkData)
|
|||
nsAutoString media;
|
||||
nsAutoString anchor;
|
||||
nsAutoString crossOrigin;
|
||||
nsAutoString destination;
|
||||
|
||||
crossOrigin.SetIsVoid(true);
|
||||
|
||||
|
|
@ -653,6 +654,11 @@ nsContentSink::ProcessLinkHeader(const nsAString& aLinkData)
|
|||
crossOrigin = value;
|
||||
crossOrigin.StripWhitespace();
|
||||
}
|
||||
} else if (attr.LowerCaseEqualsLiteral("as")) {
|
||||
if (destination.IsEmpty()) {
|
||||
destination = value;
|
||||
destination.StripWhitespace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -666,7 +672,7 @@ nsContentSink::ProcessLinkHeader(const nsAString& aLinkData)
|
|||
rv = ProcessLink(anchor, href, rel,
|
||||
// prefer RFC 5987 variant over non-I18zed version
|
||||
titleStar.IsEmpty() ? title : titleStar,
|
||||
type, media, crossOrigin);
|
||||
type, media, crossOrigin, destination);
|
||||
}
|
||||
|
||||
href.Truncate();
|
||||
|
|
@ -676,6 +682,7 @@ nsContentSink::ProcessLinkHeader(const nsAString& aLinkData)
|
|||
media.Truncate();
|
||||
anchor.Truncate();
|
||||
crossOrigin.SetIsVoid(true);
|
||||
destination.Truncate();
|
||||
|
||||
seenParameters = false;
|
||||
}
|
||||
|
|
@ -688,7 +695,7 @@ nsContentSink::ProcessLinkHeader(const nsAString& aLinkData)
|
|||
rv = ProcessLink(anchor, href, rel,
|
||||
// prefer RFC 5987 variant over non-I18zed version
|
||||
titleStar.IsEmpty() ? title : titleStar,
|
||||
type, media, crossOrigin);
|
||||
type, media, crossOrigin, destination);
|
||||
}
|
||||
|
||||
return rv;
|
||||
|
|
@ -699,7 +706,8 @@ nsresult
|
|||
nsContentSink::ProcessLink(const nsSubstring& aAnchor, const nsSubstring& aHref,
|
||||
const nsSubstring& aRel, const nsSubstring& aTitle,
|
||||
const nsSubstring& aType, const nsSubstring& aMedia,
|
||||
const nsSubstring& aCrossOrigin)
|
||||
const nsSubstring& aCrossOrigin,
|
||||
const nsSubstring& aDestination)
|
||||
{
|
||||
uint32_t linkTypes =
|
||||
nsStyleLinkElement::ParseLinkTypes(aRel, mDocument->NodePrincipal());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue