mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-07 00:08:39 +09:00
Issue #2158 - Part 4: Dispatch load/error events upon parsing preload links
This commit is contained in:
parent
b0d2af4e01
commit
95490b25eb
7 changed files with 408 additions and 25 deletions
|
|
@ -176,7 +176,7 @@ HTMLLinkElement::BindToTree(nsIDocument* aDocument,
|
|||
|
||||
if (nsIDocument* doc = GetComposedDoc()) {
|
||||
doc->RegisterPendingLinkUpdate(this);
|
||||
TryDNSPrefetchPreconnectOrPrefetch();
|
||||
TrySpeculativeLoadFeature();
|
||||
}
|
||||
|
||||
void (HTMLLinkElement::*update)() = &HTMLLinkElement::UpdateStyleSheetInternal;
|
||||
|
|
@ -399,9 +399,17 @@ HTMLLinkElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
|||
UpdateImport();
|
||||
}
|
||||
|
||||
if ((aName == nsGkAtoms::rel || aName == nsGkAtoms::href) &&
|
||||
IsInComposedDoc()) {
|
||||
TryDNSPrefetchPreconnectOrPrefetch();
|
||||
if (IsInComposedDoc()) {
|
||||
if (aName == nsGkAtoms::rel || aName == nsGkAtoms::href) {
|
||||
TrySpeculativeLoadFeature();
|
||||
}
|
||||
|
||||
if (aName == nsGkAtoms::as ||
|
||||
aName == nsGkAtoms::type ||
|
||||
aName == nsGkAtoms::crossorigin ||
|
||||
aName == nsGkAtoms::media) {
|
||||
UpdatePreload(aName, aValue, aOldValue);
|
||||
}
|
||||
}
|
||||
|
||||
UpdateStyleSheetInternal(nullptr, nullptr,
|
||||
|
|
@ -428,6 +436,13 @@ HTMLLinkElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
|||
(LINK_DISABLED && aName == nsGkAtoms::disabled)) {
|
||||
UpdateStyleSheetInternal(nullptr, nullptr, true);
|
||||
}
|
||||
if ((aName == nsGkAtoms::as ||
|
||||
aName == nsGkAtoms::type ||
|
||||
aName == nsGkAtoms::crossorigin ||
|
||||
aName == nsGkAtoms::media) &&
|
||||
IsInComposedDoc()) {
|
||||
UpdatePreload(aName, aValue, aOldValue);
|
||||
}
|
||||
if (aName == nsGkAtoms::href ||
|
||||
aName == nsGkAtoms::rel) {
|
||||
UpdateImport();
|
||||
|
|
@ -531,7 +546,8 @@ HTMLLinkElement::GetStyleSheetInfo(nsAString& aTitle,
|
|||
|
||||
nsAutoString rel;
|
||||
GetAttr(kNameSpaceID_None, nsGkAtoms::rel, rel);
|
||||
uint32_t linkTypes = nsStyleLinkElement::ParseLinkTypes(rel, NodePrincipal());
|
||||
uint32_t linkTypes =
|
||||
nsStyleLinkElement::ParseLinkTypes(rel, NodePrincipal());
|
||||
// Is it a stylesheet link?
|
||||
if (!(linkTypes & nsStyleLinkElement::eSTYLESHEET)) {
|
||||
return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue