Bug 1846178 - Use the async/defer (non-blocking) HTML parser code path for module scripts. r=smaug

Differential Revision: https://phabricator.services.mozilla.com/D185797
This commit is contained in:
Henri Sivonen 2023-09-15 07:53:16 +00:00
Родитель 574840f6fd
Коммит 2ea4ba1cf2
26 изменённых файлов: 375 добавлений и 149 удалений

Просмотреть файл

@ -10894,7 +10894,7 @@ _ZN5style7stylist7Stylist17remove_stylesheet17hfe4c712439a88006E
?FireScrollPortEvent@ScrollFrameHelper@mozilla@@QAE?AW4nsresult@@XZ
??$RemoveElement@PAVnsAPostRefreshObserver@@@?$nsAutoTObserverArray@PAVnsAPostRefreshObserver@@$0A@@@QAE_NABQAVnsAPostRefreshObserver@@@Z
?ToJSValue@dom@mozilla@@YA_NPAUJSContext@@ABV?$Rooted@VValue@JS@@@JS@@V?$MutableHandle@VValue@JS@@@5@@Z
??$destroy@V?$Variant@Uuninitialized@@UopAppend@@UopDetach@@UopAppendChildrenToNewParent@@UopFosterParent@@UopAppendToDocument@@UopAddAttributes@@W4nsHtml5DocumentMode@@UopCreateHTMLElement@@UopCreateSVGElement@@UopCreateMathMLElement@@UopSetFormElement@@UopAppendText@@UopFosterParentText@@UopAppendComment@@UopAppendCommentToDocument@@UopAppendDoctypeToDocument@@UopGetDocumentFragmentForTemplate@@UopGetFosterParent@@UopMarkAsBroken@@UopRunScript@@UopRunScriptAsyncDefer@@UopPreventScriptExecution@@UopDoneAddingChildren@@UopDoneCreatingElement@@UopSetDocumentCharset@@UopCharsetSwitchTo@@UopUpdateStyleSheet@@UopProcessOfflineManifest@@UopMarkMalformedIfScript@@UopStreamEnded@@UopSetStyleLineNumber@@UopSetScriptLineAndColumnNumberAndFreeze@@UopSvgLoad@@UopMaybeComplainAboutCharset@@UopMaybeComplainAboutDeepTree@@UopAddClass@@UopAddViewSourceHref@@UopAddViewSourceBase@@UopAddErrorType@@UopAddLineNumberId@@UopStartLayout@@UopEnableEncodingMenu@@@mozilla@@@?$VariantImplementation@E$0BG@UopPreventScriptExecution@@UopDoneAddingChildren@@UopDoneCreatingElement@@UopSetDocumentCharset@@UopCharsetSwitchTo@@UopUpdateStyleSheet@@UopProcessOfflineManifest@@UopMarkMalformedIfScript@@UopStreamEnded@@UopSetStyleLineNumber@@UopSetScriptLineAndColumnNumberAndFreeze@@UopSvgLoad@@UopMaybeComplainAboutCharset@@UopMaybeComplainAboutDeepTree@@UopAddClass@@UopAddViewSourceHref@@UopAddViewSourceBase@@UopAddErrorType@@UopAddLineNumberId@@UopStartLayout@@UopEnableEncodingMenu@@@detail@mozilla@@SAXAAV?$Variant@Uuninitialized@@UopAppend@@UopDetach@@UopAppendChildrenToNewParent@@UopFosterParent@@UopAppendToDocument@@UopAddAttributes@@W4nsHtml5DocumentMode@@UopCreateHTMLElement@@UopCreateSVGElement@@UopCreateMathMLElement@@UopSetFormElement@@UopAppendText@@UopFosterParentText@@UopAppendComment@@UopAppendCommentToDocument@@UopAppendDoctypeToDocument@@UopGetDocumentFragmentForTemplate@@UopGetFosterParent@@UopMarkAsBroken@@UopRunScript@@UopRunScriptAsyncDefer@@UopPreventScriptExecution@@UopDoneAddingChildren@@UopDoneCre
??$destroy@V?$Variant@Uuninitialized@@UopAppend@@UopDetach@@UopAppendChildrenToNewParent@@UopFosterParent@@UopAppendToDocument@@UopAddAttributes@@W4nsHtml5DocumentMode@@UopCreateHTMLElement@@UopCreateSVGElement@@UopCreateMathMLElement@@UopSetFormElement@@UopAppendText@@UopFosterParentText@@UopAppendComment@@UopAppendCommentToDocument@@UopAppendDoctypeToDocument@@UopGetDocumentFragmentForTemplate@@UopGetFosterParent@@UopMarkAsBroken@@UopRunScriptThatMayDocumentWriteOrBlock@@UopRunScriptThatCannotDocumentWriteOrBlock@@UopPreventScriptExecution@@UopDoneAddingChildren@@UopDoneCreatingElement@@UopSetDocumentCharset@@UopCharsetSwitchTo@@UopUpdateStyleSheet@@UopProcessOfflineManifest@@UopMarkMalformedIfScript@@UopStreamEnded@@UopSetStyleLineNumber@@UopSetScriptLineAndColumnNumberAndFreeze@@UopSvgLoad@@UopMaybeComplainAboutCharset@@UopMaybeComplainAboutDeepTree@@UopAddClass@@UopAddViewSourceHref@@UopAddViewSourceBase@@UopAddErrorType@@UopAddLineNumberId@@UopStartLayout@@UopEnableEncodingMenu@@@mozilla@@@?$VariantImplementation@E$0BG@UopPreventScriptExecution@@UopDoneAddingChildren@@UopDoneCreatingElement@@UopSetDocumentCharset@@UopCharsetSwitchTo@@UopUpdateStyleSheet@@UopProcessOfflineManifest@@UopMarkMalformedIfScript@@UopStreamEnded@@UopSetStyleLineNumber@@UopSetScriptLineAndColumnNumberAndFreeze@@UopSvgLoad@@UopMaybeComplainAboutCharset@@UopMaybeComplainAboutDeepTree@@UopAddClass@@UopAddViewSourceHref@@UopAddViewSourceBase@@UopAddErrorType@@UopAddLineNumberId@@UopStartLayout@@UopEnableEncodingMenu@@@detail@mozilla@@SAXAAV?$Variant@Uuninitialized@@UopAppend@@UopDetach@@UopAppendChildrenToNewParent@@UopFosterParent@@UopAppendToDocument@@UopAddAttributes@@W4nsHtml5DocumentMode@@UopCreateHTMLElement@@UopCreateSVGElement@@UopCreateMathMLElement@@UopSetFormElement@@UopAppendText@@UopFosterParentText@@UopAppendComment@@UopAppendCommentToDocument@@UopAppendDoctypeToDocument@@UopGetDocumentFragmentForTemplate@@UopGetFosterParent@@UopMarkAsBroken@@UopRunScriptThatMayDocumentWriteOrBlock@@UopRunScriptThatCannotDocumentWriteOrBlock@@UopPreventScriptExecution@@UopDoneAddingChildren@@UopDoneCre
?UnbindFromTree@SVGSVGElement@dom@mozilla@@UAEX_N@Z
?ClearMilestones@SMILTimeContainer@mozilla@@QAEXXZ
?AnimationNeedsResample@SVGElement@dom@mozilla@@QAEXXZ
@ -13354,7 +13354,7 @@ _ZN5style10properties9longhands9fill_rule16cascade_property17h9aad254200b7c674E
?EnsureBufferSpace@nsHtml5Tokenizer@@QAE_NH@Z
?tokenizeBuffer@nsHtml5Tokenizer@@QAE_NPAVnsHtml5UTF16Buffer@@@Z
?ParseDocument@nsHtml5StringParser@@QAE?AW4nsresult@@ABV?$nsTSubstring@_S@@PAVDocument@dom@mozilla@@_N@Z
??4?$Variant@Uuninitialized@@UopAppend@@UopDetach@@UopAppendChildrenToNewParent@@UopFosterParent@@UopAppendToDocument@@UopAddAttributes@@W4nsHtml5DocumentMode@@UopCreateHTMLElement@@UopCreateSVGElement@@UopCreateMathMLElement@@UopSetFormElement@@UopAppendText@@UopFosterParentText@@UopAppendComment@@UopAppendCommentToDocument@@UopAppendDoctypeToDocument@@UopGetDocumentFragmentForTemplate@@UopGetFosterParent@@UopMarkAsBroken@@UopRunScript@@UopRunScriptAsyncDefer@@UopPreventScriptExecution@@UopDoneAddingChildren@@UopDoneCreatingElement@@UopSetDocumentCharset@@UopCharsetSwitchTo@@UopUpdateStyleSheet@@UopProcessOfflineManifest@@UopMarkMalformedIfScript@@UopStreamEnded@@UopSetStyleLineNumber@@UopSetScriptLineAndColumnNumberAndFreeze@@UopSvgLoad@@UopMaybeComplainAboutCharset@@UopMaybeComplainAboutDeepTree@@UopAddClass@@UopAddViewSourceHref@@UopAddViewSourceBase@@UopAddErrorType@@UopAddLineNumberId@@UopStartLayout@@UopEnableEncodingMenu@@@mozilla@@QAEAAV01@ABV01@@Z
??4?$Variant@Uuninitialized@@UopAppend@@UopDetach@@UopAppendChildrenToNewParent@@UopFosterParent@@UopAppendToDocument@@UopAddAttributes@@W4nsHtml5DocumentMode@@UopCreateHTMLElement@@UopCreateSVGElement@@UopCreateMathMLElement@@UopSetFormElement@@UopAppendText@@UopFosterParentText@@UopAppendComment@@UopAppendCommentToDocument@@UopAppendDoctypeToDocument@@UopGetDocumentFragmentForTemplate@@UopGetFosterParent@@UopMarkAsBroken@@UopRunScriptThatMayDocumentWriteOrBlock@@UopRunScriptThatCannotDocumentWriteOrBlock@@UopPreventScriptExecution@@UopDoneAddingChildren@@UopDoneCreatingElement@@UopSetDocumentCharset@@UopCharsetSwitchTo@@UopUpdateStyleSheet@@UopProcessOfflineManifest@@UopMarkMalformedIfScript@@UopStreamEnded@@UopSetStyleLineNumber@@UopSetScriptLineAndColumnNumberAndFreeze@@UopSvgLoad@@UopMaybeComplainAboutCharset@@UopMaybeComplainAboutDeepTree@@UopAddClass@@UopAddViewSourceHref@@UopAddViewSourceBase@@UopAddErrorType@@UopAddLineNumberId@@UopStartLayout@@UopEnableEncodingMenu@@@mozilla@@QAEAAV01@ABV01@@Z
?newLocalNameFromBuffer@nsHtml5Portability@@SAPAVnsAtom@@PA_SHPAVnsHtml5AtomTable@@@Z
?newStringFromBuffer@nsHtml5Portability@@SA?AVnsHtml5String@@PA_SHHPAVnsHtml5TreeBuilder@@_N@Z
?FromBuffer@nsHtml5String@@SA?AV1@PA_SHPAVnsHtml5TreeBuilder@@@Z
@ -13362,7 +13362,7 @@ _ZN5style10properties9longhands9fill_rule16cascade_property17h9aad254200b7c674E
?Active@DOMMediaStream@mozilla@@QBE_NXZ
??0nsHtml5HtmlAttributes@@QAE@H@Z
?addAttribute@nsHtml5HtmlAttributes@@QAEXPAVnsHtml5AttributeName@@VnsHtml5String@@H@Z
??$copyConstruct@V?$Variant@Uuninitialized@@UopAppend@@UopDetach@@UopAppendChildrenToNewParent@@UopFosterParent@@UopAppendToDocument@@UopAddAttributes@@W4nsHtml5DocumentMode@@UopCreateHTMLElement@@UopCreateSVGElement@@UopCreateMathMLElement@@UopSetFormElement@@UopAppendText@@UopFosterParentText@@UopAppendComment@@UopAppendCommentToDocument@@UopAppendDoctypeToDocument@@UopGetDocumentFragmentForTemplate@@UopGetFosterParent@@UopMarkAsBroken@@UopRunScript@@UopRunScriptAsyncDefer@@UopPreventScriptExecution@@UopDoneAddingChildren@@UopDoneCreatingElement@@UopSetDocumentCharset@@UopCharsetSwitchTo@@UopUpdateStyleSheet@@UopProcessOfflineManifest@@UopMarkMalformedIfScript@@UopStreamEnded@@UopSetStyleLineNumber@@UopSetScriptLineAndColumnNumberAndFreeze@@UopSvgLoad@@UopMaybeComplainAboutCharset@@UopMaybeComplainAboutDeepTree@@UopAddClass@@UopAddViewSourceHref@@UopAddViewSourceBase@@UopAddErrorType@@UopAddLineNumberId@@UopStartLayout@@UopEnableEncodingMenu@@@mozilla@@@?$VariantImplementation@E$0BC@UopGetFosterParent@@UopMarkAsBroken@@UopRunScript@@UopRunScriptAsyncDefer@@UopPreventScriptExecution@@UopDoneAddingChildren@@UopDoneCreatingElement@@UopSetDocumentCharset@@UopCharsetSwitchTo@@UopUpdateStyleSheet@@UopProcessOfflineManifest@@UopMarkMalformedIfScript@@UopStreamEnded@@UopSetStyleLineNumber@@UopSetScriptLineAndColumnNumberAndFreeze@@UopSvgLoad@@UopMaybeComplainAboutCharset@@UopMaybeComplainAboutDeepTree@@UopAddClass@@UopAddViewSourceHref@@UopAddViewSourceBase@@UopAddErrorType@@UopAddLineNumberId@@UopStartLayout@@UopEnableEncodingMenu@@@detail@mozilla@@SAXPAXABV?$Variant@Uuninitialized@@UopAppend@@UopDetach@@UopAppendChildrenToNewParent@@UopFosterParent@@UopAppendToDocument@@UopAddAttributes@@W4nsHtml5DocumentMode@@UopCreateHTMLElement@@UopCreateSVGElement@@UopCreateMathMLElement@@UopSetFormElement@@UopAppendText@@UopFosterParentText@@UopAppendComment@@UopAppendCommentToDocument@@UopAppendDoctypeToDocument@@UopGetDocumentFragmentForTemplate@@UopGetFosterParent@@UopMarkAsBroken@@UopRunScript@@
??$copyConstruct@V?$Variant@Uuninitialized@@UopAppend@@UopDetach@@UopAppendChildrenToNewParent@@UopFosterParent@@UopAppendToDocument@@UopAddAttributes@@W4nsHtml5DocumentMode@@UopCreateHTMLElement@@UopCreateSVGElement@@UopCreateMathMLElement@@UopSetFormElement@@UopAppendText@@UopFosterParentText@@UopAppendComment@@UopAppendCommentToDocument@@UopAppendDoctypeToDocument@@UopGetDocumentFragmentForTemplate@@UopGetFosterParent@@UopMarkAsBroken@@UopRunScriptThatMayDocumentWriteOrBlock@@UopRunScriptThatCannotDocumentWriteOrBlock@@UopPreventScriptExecution@@UopDoneAddingChildren@@UopDoneCreatingElement@@UopSetDocumentCharset@@UopCharsetSwitchTo@@UopUpdateStyleSheet@@UopProcessOfflineManifest@@UopMarkMalformedIfScript@@UopStreamEnded@@UopSetStyleLineNumber@@UopSetScriptLineAndColumnNumberAndFreeze@@UopSvgLoad@@UopMaybeComplainAboutCharset@@UopMaybeComplainAboutDeepTree@@UopAddClass@@UopAddViewSourceHref@@UopAddViewSourceBase@@UopAddErrorType@@UopAddLineNumberId@@UopStartLayout@@UopEnableEncodingMenu@@@mozilla@@@?$VariantImplementation@E$0BC@UopGetFosterParent@@UopMarkAsBroken@@UopRunScriptThatMayDocumentWriteOrBlock@@UopRunScriptThatCannotDocumentWriteOrBlock@@UopPreventScriptExecution@@UopDoneAddingChildren@@UopDoneCreatingElement@@UopSetDocumentCharset@@UopCharsetSwitchTo@@UopUpdateStyleSheet@@UopProcessOfflineManifest@@UopMarkMalformedIfScript@@UopStreamEnded@@UopSetStyleLineNumber@@UopSetScriptLineAndColumnNumberAndFreeze@@UopSvgLoad@@UopMaybeComplainAboutCharset@@UopMaybeComplainAboutDeepTree@@UopAddClass@@UopAddViewSourceHref@@UopAddViewSourceBase@@UopAddErrorType@@UopAddLineNumberId@@UopStartLayout@@UopEnableEncodingMenu@@@detail@mozilla@@SAXPAXABV?$Variant@Uuninitialized@@UopAppend@@UopDetach@@UopAppendChildrenToNewParent@@UopFosterParent@@UopAppendToDocument@@UopAddAttributes@@W4nsHtml5DocumentMode@@UopCreateHTMLElement@@UopCreateSVGElement@@UopCreateMathMLElement@@UopSetFormElement@@UopAppendText@@UopFosterParentText@@UopAppendComment@@UopAppendCommentToDocument@@UopAppendDoctypeToDocument@@UopGetDocumentFragmentForTemplate@@UopGetFosterParent@@UopMarkAsBroken@@UopRunScriptThatMayDocumentWriteOrBlock@@
?_Target_type@?$_Func_impl_no_alloc@P6A_NVTimeStamp@mozilla@@@Z_NV12@@std@@EBEABVtype_info@@XZ
?eof@nsHtml5Tokenizer@@QAEXXZ
?StreamEnded@nsHtml5TreeBuilder@@QAEXXZ

Просмотреть файл

@ -12409,7 +12409,7 @@ skcms_TransferFunction_invert
?NS_NewSVGCircleElement@@YA?AW4nsresult@@PEAPEAVnsIContent@@$$QEAU?$already_AddRefed@VNodeInfo@dom@mozilla@@@@@Z
?GetLengthInfo@SVGCircleElement@dom@mozilla@@MEAA?AULengthAttributesInfo@SVGElement@23@XZ
?ToString@SVGAttrValueWrapper@mozilla@@SAXPEBVSVGTransformList@2@AEAV?$nsTSubstring@_S@@@Z
??$destroy@V?$Variant@Uuninitialized@@UopAppend@@UopDetach@@UopAppendChildrenToNewParent@@UopFosterParent@@UopAppendToDocument@@UopAddAttributes@@W4nsHtml5DocumentMode@@UopCreateHTMLElement@@UopCreateSVGElement@@UopCreateMathMLElement@@UopSetFormElement@@UopAppendText@@UopFosterParentText@@UopAppendComment@@UopAppendCommentToDocument@@UopAppendDoctypeToDocument@@UopGetDocumentFragmentForTemplate@@UopGetFosterParent@@UopMarkAsBroken@@UopRunScript@@UopRunScriptAsyncDefer@@UopPreventScriptExecution@@UopDoneAddingChildren@@UopDoneCreatingElement@@UopSetDocumentCharset@@UopCharsetSwitchTo@@UopUpdateStyleSheet@@UopProcessOfflineManifest@@UopMarkMalformedIfScript@@UopStreamEnded@@UopSetStyleLineNumber@@UopSetScriptLineAndColumnNumberAndFreeze@@UopSvgLoad@@UopMaybeComplainAboutCharset@@UopMaybeComplainAboutDeepTree@@UopAddClass@@UopAddViewSourceHref@@UopAddViewSourceBase@@UopAddErrorType@@UopAddLineNumberId@@UopStartLayout@@UopEnableEncodingMenu@@@mozilla@@@?$VariantImplementation@E$0BG@UopPreventScriptExecution@@UopDoneAddingChildren@@UopDoneCreatingElement@@UopSetDocumentCharset@@UopCharsetSwitchTo@@UopUpdateStyleSheet@@UopProcessOfflineManifest@@UopMarkMalformedIfScript@@UopStreamEnded@@UopSetStyleLineNumber@@UopSetScriptLineAndColumnNumberAndFreeze@@UopSvgLoad@@UopMaybeComplainAboutCharset@@UopMaybeComplainAboutDeepTree@@UopAddClass@@UopAddViewSourceHref@@UopAddViewSourceBase@@UopAddErrorType@@UopAddLineNumberId@@UopStartLayout@@UopEnableEncodingMenu@@@detail@mozilla@@SAXAEAV?$Variant@Uuninitialized@@UopAppend@@UopDetach@@UopAppendChildrenToNewParent@@UopFosterParent@@UopAppendToDocument@@UopAddAttributes@@W4nsHtml5DocumentMode@@UopCreateHTMLElement@@UopCreateSVGElement@@UopCreateMathMLElement@@UopSetFormElement@@UopAppendText@@UopFosterParentText@@UopAppendComment@@UopAppendCommentToDocument@@UopAppendDoctypeToDocument@@UopGetDocumentFragmentForTemplate@@UopGetFosterParent@@UopMarkAsBroken@@UopRunScript@@UopRunScriptAsyncDefer@@UopPreventScriptExecution@@UopDoneAddingChildren@@UopDoneCr
??$destroy@V?$Variant@Uuninitialized@@UopAppend@@UopDetach@@UopAppendChildrenToNewParent@@UopFosterParent@@UopAppendToDocument@@UopAddAttributes@@W4nsHtml5DocumentMode@@UopCreateHTMLElement@@UopCreateSVGElement@@UopCreateMathMLElement@@UopSetFormElement@@UopAppendText@@UopFosterParentText@@UopAppendComment@@UopAppendCommentToDocument@@UopAppendDoctypeToDocument@@UopGetDocumentFragmentForTemplate@@UopGetFosterParent@@UopMarkAsBroken@@UopRunScriptThatMayDocumentWriteOrBlock@@UopRunScriptThatCannotDocumentWriteOrBlock@@UopPreventScriptExecution@@UopDoneAddingChildren@@UopDoneCreatingElement@@UopSetDocumentCharset@@UopCharsetSwitchTo@@UopUpdateStyleSheet@@UopProcessOfflineManifest@@UopMarkMalformedIfScript@@UopStreamEnded@@UopSetStyleLineNumber@@UopSetScriptLineAndColumnNumberAndFreeze@@UopSvgLoad@@UopMaybeComplainAboutCharset@@UopMaybeComplainAboutDeepTree@@UopAddClass@@UopAddViewSourceHref@@UopAddViewSourceBase@@UopAddErrorType@@UopAddLineNumberId@@UopStartLayout@@UopEnableEncodingMenu@@@mozilla@@@?$VariantImplementation@E$0BG@UopPreventScriptExecution@@UopDoneAddingChildren@@UopDoneCreatingElement@@UopSetDocumentCharset@@UopCharsetSwitchTo@@UopUpdateStyleSheet@@UopProcessOfflineManifest@@UopMarkMalformedIfScript@@UopStreamEnded@@UopSetStyleLineNumber@@UopSetScriptLineAndColumnNumberAndFreeze@@UopSvgLoad@@UopMaybeComplainAboutCharset@@UopMaybeComplainAboutDeepTree@@UopAddClass@@UopAddViewSourceHref@@UopAddViewSourceBase@@UopAddErrorType@@UopAddLineNumberId@@UopStartLayout@@UopEnableEncodingMenu@@@detail@mozilla@@SAXAEAV?$Variant@Uuninitialized@@UopAppend@@UopDetach@@UopAppendChildrenToNewParent@@UopFosterParent@@UopAppendToDocument@@UopAddAttributes@@W4nsHtml5DocumentMode@@UopCreateHTMLElement@@UopCreateSVGElement@@UopCreateMathMLElement@@UopSetFormElement@@UopAppendText@@UopFosterParentText@@UopAppendComment@@UopAppendCommentToDocument@@UopAppendDoctypeToDocument@@UopGetDocumentFragmentForTemplate@@UopGetFosterParent@@UopMarkAsBroken@@UopRunScriptThatMayDocumentWriteOrBlock@@UopRunScriptThatCannotDocumentWriteOrBlock@@UopPreventScriptExecution@@UopDoneAddingChildren@@UopDoneCr
?UnbindFromTree@SVGSVGElement@dom@mozilla@@UEAAX_N@Z
?GetParentTime@SMILTimeContainer@mozilla@@UEBA_JXZ
?AnimationNeedsResample@SVGElement@dom@mozilla@@QEAAXXZ
@ -13486,13 +13486,13 @@ ZN5style10properties9longhands9fill_rule16cascade_property17hb0caefa465b1b9f9E
?Start@nsHtml5TreeOpExecutor@@QEAAXXZ
?tokenizeBuffer@nsHtml5Tokenizer@@QEAA_NPEAVnsHtml5UTF16Buffer@@@Z
?ParseDocument@nsHtml5StringParser@@QEAA?AW4nsresult@@AEBV?$nsTSubstring@_S@@PEAVDocument@dom@mozilla@@_N@Z
??4?$Variant@Uuninitialized@@UopAppend@@UopDetach@@UopAppendChildrenToNewParent@@UopFosterParent@@UopAppendToDocument@@UopAddAttributes@@W4nsHtml5DocumentMode@@UopCreateHTMLElement@@UopCreateSVGElement@@UopCreateMathMLElement@@UopSetFormElement@@UopAppendText@@UopFosterParentText@@UopAppendComment@@UopAppendCommentToDocument@@UopAppendDoctypeToDocument@@UopGetDocumentFragmentForTemplate@@UopGetFosterParent@@UopMarkAsBroken@@UopRunScript@@UopRunScriptAsyncDefer@@UopPreventScriptExecution@@UopDoneAddingChildren@@UopDoneCreatingElement@@UopSetDocumentCharset@@UopCharsetSwitchTo@@UopUpdateStyleSheet@@UopProcessOfflineManifest@@UopMarkMalformedIfScript@@UopStreamEnded@@UopSetStyleLineNumber@@UopSetScriptLineAndColumnNumberAndFreeze@@UopSvgLoad@@UopMaybeComplainAboutCharset@@UopMaybeComplainAboutDeepTree@@UopAddClass@@UopAddViewSourceHref@@UopAddViewSourceBase@@UopAddErrorType@@UopAddLineNumberId@@UopStartLayout@@UopEnableEncodingMenu@@@mozilla@@QEAAAEAV01@AEBV01@@Z
??4?$Variant@Uuninitialized@@UopAppend@@UopDetach@@UopAppendChildrenToNewParent@@UopFosterParent@@UopAppendToDocument@@UopAddAttributes@@W4nsHtml5DocumentMode@@UopCreateHTMLElement@@UopCreateSVGElement@@UopCreateMathMLElement@@UopSetFormElement@@UopAppendText@@UopFosterParentText@@UopAppendComment@@UopAppendCommentToDocument@@UopAppendDoctypeToDocument@@UopGetDocumentFragmentForTemplate@@UopGetFosterParent@@UopMarkAsBroken@@UopRunScriptThatMayDocumentWriteOrBlock@@UopRunScriptThatCannotDocumentWriteOrBlock@@UopPreventScriptExecution@@UopDoneAddingChildren@@UopDoneCreatingElement@@UopSetDocumentCharset@@UopCharsetSwitchTo@@UopUpdateStyleSheet@@UopProcessOfflineManifest@@UopMarkMalformedIfScript@@UopStreamEnded@@UopSetStyleLineNumber@@UopSetScriptLineAndColumnNumberAndFreeze@@UopSvgLoad@@UopMaybeComplainAboutCharset@@UopMaybeComplainAboutDeepTree@@UopAddClass@@UopAddViewSourceHref@@UopAddViewSourceBase@@UopAddErrorType@@UopAddLineNumberId@@UopStartLayout@@UopEnableEncodingMenu@@@mozilla@@QEAAAEAV01@AEBV01@@Z
?newLocalNameFromBuffer@nsHtml5Portability@@SAPEAVnsAtom@@PEA_SHPEAVnsHtml5AtomTable@@@Z
?newStringFromBuffer@nsHtml5Portability@@SA?AVnsHtml5String@@PEA_SHHPEAVnsHtml5TreeBuilder@@_N@Z
?CopyFrom@?$Buffer@E@mozilla@@SA?AV?$Maybe@V?$Buffer@E@mozilla@@@2@V?$Span@$$CBE$0?0@2@@Z
?PassThrough@AudioNode@dom@mozilla@@QEBA_NXZ
?addAttribute@nsHtml5HtmlAttributes@@QEAAXPEAVnsHtml5AttributeName@@VnsHtml5String@@H@Z
??$copyConstruct@V?$Variant@Uuninitialized@@UopAppend@@UopDetach@@UopAppendChildrenToNewParent@@UopFosterParent@@UopAppendToDocument@@UopAddAttributes@@W4nsHtml5DocumentMode@@UopCreateHTMLElement@@UopCreateSVGElement@@UopCreateMathMLElement@@UopSetFormElement@@UopAppendText@@UopFosterParentText@@UopAppendComment@@UopAppendCommentToDocument@@UopAppendDoctypeToDocument@@UopGetDocumentFragmentForTemplate@@UopGetFosterParent@@UopMarkAsBroken@@UopRunScript@@UopRunScriptAsyncDefer@@UopPreventScriptExecution@@UopDoneAddingChildren@@UopDoneCreatingElement@@UopSetDocumentCharset@@UopCharsetSwitchTo@@UopUpdateStyleSheet@@UopProcessOfflineManifest@@UopMarkMalformedIfScript@@UopStreamEnded@@UopSetStyleLineNumber@@UopSetScriptLineAndColumnNumberAndFreeze@@UopSvgLoad@@UopMaybeComplainAboutCharset@@UopMaybeComplainAboutDeepTree@@UopAddClass@@UopAddViewSourceHref@@UopAddViewSourceBase@@UopAddErrorType@@UopAddLineNumberId@@UopStartLayout@@UopEnableEncodingMenu@@@mozilla@@@?$VariantImplementation@E$0BB@UopGetDocumentFragmentForTemplate@@UopGetFosterParent@@UopMarkAsBroken@@UopRunScript@@UopRunScriptAsyncDefer@@UopPreventScriptExecution@@UopDoneAddingChildren@@UopDoneCreatingElement@@UopSetDocumentCharset@@UopCharsetSwitchTo@@UopUpdateStyleSheet@@UopProcessOfflineManifest@@UopMarkMalformedIfScript@@UopStreamEnded@@UopSetStyleLineNumber@@UopSetScriptLineAndColumnNumberAndFreeze@@UopSvgLoad@@UopMaybeComplainAboutCharset@@UopMaybeComplainAboutDeepTree@@UopAddClass@@UopAddViewSourceHref@@UopAddViewSourceBase@@UopAddErrorType@@UopAddLineNumberId@@UopStartLayout@@UopEnableEncodingMenu@@@detail@mozilla@@SAXPEAXAEBV?$Variant@Uuninitialized@@UopAppend@@UopDetach@@UopAppendChildrenToNewParent@@UopFosterParent@@UopAppendToDocument@@UopAddAttributes@@W4nsHtml5DocumentMode@@UopCreateHTMLElement@@UopCreateSVGElement@@UopCreateMathMLElement@@UopSetFormElement@@UopAppendText@@UopFosterParentText@@UopAppendComment@@UopAppendCommentToDocument@@UopAppendDoctypeToDocument@@UopGetDocumentFragmentForTemplate@@UopGetFosterPa
??$copyConstruct@V?$Variant@Uuninitialized@@UopAppend@@UopDetach@@UopAppendChildrenToNewParent@@UopFosterParent@@UopAppendToDocument@@UopAddAttributes@@W4nsHtml5DocumentMode@@UopCreateHTMLElement@@UopCreateSVGElement@@UopCreateMathMLElement@@UopSetFormElement@@UopAppendText@@UopFosterParentText@@UopAppendComment@@UopAppendCommentToDocument@@UopAppendDoctypeToDocument@@UopGetDocumentFragmentForTemplate@@UopGetFosterParent@@UopMarkAsBroken@@UopRunScriptThatMayDocumentWriteOrBlock@@UopRunScriptThatCannotDocumentWriteOrBlock@@UopPreventScriptExecution@@UopDoneAddingChildren@@UopDoneCreatingElement@@UopSetDocumentCharset@@UopCharsetSwitchTo@@UopUpdateStyleSheet@@UopProcessOfflineManifest@@UopMarkMalformedIfScript@@UopStreamEnded@@UopSetStyleLineNumber@@UopSetScriptLineAndColumnNumberAndFreeze@@UopSvgLoad@@UopMaybeComplainAboutCharset@@UopMaybeComplainAboutDeepTree@@UopAddClass@@UopAddViewSourceHref@@UopAddViewSourceBase@@UopAddErrorType@@UopAddLineNumberId@@UopStartLayout@@UopEnableEncodingMenu@@@mozilla@@@?$VariantImplementation@E$0BB@UopGetDocumentFragmentForTemplate@@UopGetFosterParent@@UopMarkAsBroken@@UopRunScriptThatMayDocumentWriteOrBlock@@UopRunScriptThatCannotDocumentWriteOrBlock@@UopPreventScriptExecution@@UopDoneAddingChildren@@UopDoneCreatingElement@@UopSetDocumentCharset@@UopCharsetSwitchTo@@UopUpdateStyleSheet@@UopProcessOfflineManifest@@UopMarkMalformedIfScript@@UopStreamEnded@@UopSetStyleLineNumber@@UopSetScriptLineAndColumnNumberAndFreeze@@UopSvgLoad@@UopMaybeComplainAboutCharset@@UopMaybeComplainAboutDeepTree@@UopAddClass@@UopAddViewSourceHref@@UopAddViewSourceBase@@UopAddErrorType@@UopAddLineNumberId@@UopStartLayout@@UopEnableEncodingMenu@@@detail@mozilla@@SAXPEAXAEBV?$Variant@Uuninitialized@@UopAppend@@UopDetach@@UopAppendChildrenToNewParent@@UopFosterParent@@UopAppendToDocument@@UopAddAttributes@@W4nsHtml5DocumentMode@@UopCreateHTMLElement@@UopCreateSVGElement@@UopCreateMathMLElement@@UopSetFormElement@@UopAppendText@@UopFosterParentText@@UopAppendComment@@UopAppendCommentToDocument@@UopAppendDoctypeToDocument@@UopGetDocumentFragmentForTemplate@@UopGetFosterPa
?_Target_type@?$_Func_impl_no_alloc@P6A_NVTimeStamp@mozilla@@@Z_NV12@@std@@EEBAAEBVtype_info@@XZ
?eof@nsHtml5Tokenizer@@QEAAXXZ
?StreamEnded@nsHtml5TreeBuilder@@QEAAXXZ

Просмотреть файл

@ -951,6 +951,7 @@ support-files = file_sandbox_and_document_uri.html
[test_screen_orientation.html]
[test_script_loader_crossorigin_data_url.html]
[test_script_loader_js_cache.html]
disabled = https://bugzilla.mozilla.org/show_bug.cgi?id=1853173
skip-if = verify
support-files =
file_js_cache.html
@ -966,6 +967,7 @@ support-files =
file_js_cache_syntax_error.html
file_js_cache_syntax_error.js
[test_script_loader_js_cache_module.html]
disabled = https://bugzilla.mozilla.org/show_bug.cgi?id=1853173
skip-if = verify
support-files =
file_script_module_single.html
@ -1018,6 +1020,7 @@ support-files =
file_script_module_static_and_dynamic_imported_2.mjs
file_script_module_static_and_dynamic_imported_3.mjs
[test_script_loader_js_cache_module_sri.html]
disabled = https://bugzilla.mozilla.org/show_bug.cgi?id=1853173
skip-if = verify
support-files =
file_script_module_sri_basic.html

Просмотреть файл

@ -21,6 +21,8 @@
#include "js/loader/ModuleLoaderBase.h"
#include "js/loader/ModuleLoadRequest.h"
#include "mozilla/dom/RequestBinding.h"
#include "mozilla/Assertions.h"
#include "nsError.h"
#include "xpcpublic.h"
#include "GeckoProfiler.h"
#include "nsContentSecurityManager.h"
@ -127,6 +129,15 @@ nsresult ModuleLoader::StartFetch(ModuleLoadRequest* aRequest) {
return NS_OK;
}
void ModuleLoader::AsyncExecuteInlineModule(ModuleLoadRequest* aRequest) {
MOZ_ASSERT(aRequest->IsFinished());
MOZ_ASSERT(aRequest->IsTopLevel());
MOZ_ASSERT(aRequest->GetScriptLoadContext()->mIsInline);
GetScriptLoader()->MaybeMoveToLoadedList(aRequest);
GetScriptLoader()->ProcessPendingRequests();
aRequest->GetScriptLoadContext()->MaybeUnblockOnload();
}
void ModuleLoader::OnModuleLoadComplete(ModuleLoadRequest* aRequest) {
MOZ_ASSERT(aRequest->IsFinished());
@ -135,6 +146,25 @@ void ModuleLoader::OnModuleLoadComplete(ModuleLoadRequest* aRequest) {
aRequest->GetScriptLoadContext()->GetParserCreated() ==
NOT_FROM_PARSER) {
GetScriptLoader()->RunScriptWhenSafe(aRequest);
} else if (aRequest->GetScriptLoadContext()->mIsInline &&
aRequest->GetScriptLoadContext()->GetParserCreated() !=
NOT_FROM_PARSER &&
!nsContentUtils::IsSafeToRunScript()) {
// Avoid giving inline async module scripts that don't have
// external dependencies a guaranteed execution time relative
// to the HTML parse. That is, deliberately avoid guaranteeing
// that the script would always observe a DOM shape where the
// parser has not added further elements to the DOM.
// (If `nsContentUtils::IsSafeToRunScript()` returns `true`,
// we come here synchronously from the parser. If it returns
// `false` we come here from an external dependency completing
// its fetch, in which case we already are at an unspecific
// point relative to the parse.)
MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(
mozilla::NewRunnableMethod<RefPtr<ModuleLoadRequest>>(
"ModuleLoader::AsyncExecuteInlineModule", this,
&ModuleLoader::AsyncExecuteInlineModule, aRequest)));
return;
} else {
GetScriptLoader()->MaybeMoveToLoadedList(aRequest);
GetScriptLoader()->ProcessPendingRequestsAsync();

Просмотреть файл

@ -80,6 +80,8 @@ class ModuleLoader final : public JS::loader::ModuleLoaderBase {
return static_cast<ModuleLoader*>(aLoader);
}
void AsyncExecuteInlineModule(ModuleLoadRequest* aRequest);
private:
const Kind mKind;
};

Просмотреть файл

@ -28,6 +28,19 @@ ScriptElement::ScriptAvailable(nsresult aResult, nsIScriptElement* aElement,
uint32_t aLineNo) {
if (!aIsInlineClassicScript && NS_FAILED(aResult)) {
nsCOMPtr<nsIParser> parser = do_QueryReferent(mCreatorParser);
if (parser) {
nsCOMPtr<nsIContentSink> sink = parser->GetContentSink();
if (sink) {
nsCOMPtr<Document> parserDoc = do_QueryInterface(sink->GetTarget());
if (GetAsContent()->OwnerDoc() != parserDoc) {
// Suppress errors when we've moved between docs.
// /html/semantics/scripting-1/the-script-element/moving-between-documents/move-back-iframe-fetch-error-external-module.html
// See also https://bugzilla.mozilla.org/show_bug.cgi?id=1849107
return NS_OK;
}
}
}
if (parser) {
parser->IncrementScriptNestingLevel();
}
@ -172,7 +185,7 @@ bool ScriptElement::MaybeProcessScript() {
if (sink) {
nsCOMPtr<Document> parserDoc = do_QueryInterface(sink->GetTarget());
if (ownerDoc != parserDoc) {
// Willful violation of HTML5 as of 2010-12-01
// Refactor this: https://bugzilla.mozilla.org/show_bug.cgi?id=1849107
return false;
}
}

Просмотреть файл

@ -1156,7 +1156,8 @@ bool ScriptLoader::ProcessExternalScript(nsIScriptElement* aElement,
if (request->GetScriptLoadContext()->IsDeferredScript()) {
// We don't want to run this yet.
// If we come here, the script is a parser-created script and it has
// the defer attribute but not the async attribute. Since a
// the defer attribute but not the async attribute OR it is a module
// script without the async attribute. Since a
// a parser-inserted script is being run, we came here by the parser
// running the script, which means the parser is still alive and the
// parse is ongoing.
@ -3800,9 +3801,8 @@ void ScriptLoader::PreloadURI(
nsIURI* aURI, const nsAString& aCharset, const nsAString& aType,
const nsAString& aCrossOrigin, const nsAString& aNonce,
const nsAString& aFetchPriority, const nsAString& aIntegrity,
bool aScriptFromHead, bool aAsync, bool aDefer, bool aNoModule,
bool aLinkPreload, const ReferrerPolicy aReferrerPolicy,
uint64_t aEarlyHintPreloaderId) {
bool aScriptFromHead, bool aAsync, bool aDefer, bool aLinkPreload,
const ReferrerPolicy aReferrerPolicy, uint64_t aEarlyHintPreloaderId) {
NS_ENSURE_TRUE_VOID(mDocument);
// Check to see if scripts has been turned off.
if (!mEnabled || !mDocument->IsScriptEnabled()) {
@ -3811,11 +3811,6 @@ void ScriptLoader::PreloadURI(
ScriptKind scriptKind = ScriptKind::eClassic;
// Don't load nomodule scripts.
if (aNoModule) {
return;
}
static const char kASCIIWhitespace[] = "\t\n\f\r ";
nsAutoString type(aType);

Просмотреть файл

@ -388,8 +388,7 @@ class ScriptLoader final : public JS::loader::ScriptLoaderInterface {
const nsAString& aNonce,
const nsAString& aFetchPriority,
const nsAString& aIntegrity, bool aScriptFromHead,
bool aAsync, bool aDefer, bool aNoModule,
bool aLinkPreload,
bool aAsync, bool aDefer, bool aLinkPreload,
const ReferrerPolicy aReferrerPolicy,
uint64_t aEarlyHintPreloaderId);

Просмотреть файл

@ -6048,7 +6048,7 @@ public abstract class TreeBuilder<T> implements TokenHandler,
@SuppressWarnings("unchecked") public void loadState(
TreeBuilderState<T> snapshot)
throws SAXException {
// CPPONLY: mCurrentHtmlScriptIsAsyncOrDefer = false;
// CPPONLY: mCurrentHtmlScriptCannotDocumentWriteOrBlock = false;
StackNode<T>[] stackCopy = snapshot.getStack();
int stackLen = snapshot.getStackLength();
StackNode<T>[] listCopy = snapshot.getListOfActiveFormattingElements();

Просмотреть файл

@ -335,7 +335,7 @@ nsresult nsHtml5Parser::Parse(const nsAString& aSourceBuffer, void* aKey,
mTokenizer->setLineNumber(lineNumberSave);
}
if (mTreeBuilder->HasScript()) {
if (mTreeBuilder->HasScriptThatMayDocumentWriteOrBlock()) {
auto r = mTreeBuilder->Flush(); // Move ops to the executor
if (r.isErr()) {
return executor->MarkAsBroken(r.unwrapErr());
@ -626,7 +626,7 @@ nsresult nsHtml5Parser::ParseUntilBlocked() {
if (inRootContext) {
mRootContextLineNumber = mTokenizer->getLineNumber();
}
if (mTreeBuilder->HasScript()) {
if (mTreeBuilder->HasScriptThatMayDocumentWriteOrBlock()) {
auto r = mTreeBuilder->Flush();
if (r.isErr()) {
return mExecutor->MarkAsBroken(r.unwrapErr());

Просмотреть файл

@ -65,7 +65,7 @@ void nsHtml5SpeculativeLoad::Perform(nsHtml5TreeOpExecutor* aExecutor) {
mTypeOrCharsetSourceOrDocumentModeOrMetaCSPOrSizesOrIntegrity,
mCrossOrigin, mMedia, mNonce, mFetchPriority,
mReferrerPolicyOrIntegrity, mScriptReferrerPolicy, false, mIsAsync,
mIsDefer, false, mIsLinkPreload);
mIsDefer, mIsLinkPreload);
break;
case eSpeculativeLoadScriptFromHead:
aExecutor->PreloadScript(
@ -73,23 +73,7 @@ void nsHtml5SpeculativeLoad::Perform(nsHtml5TreeOpExecutor* aExecutor) {
mTypeOrCharsetSourceOrDocumentModeOrMetaCSPOrSizesOrIntegrity,
mCrossOrigin, mMedia, mNonce, mFetchPriority,
mReferrerPolicyOrIntegrity, mScriptReferrerPolicy, true, mIsAsync,
mIsDefer, false, mIsLinkPreload);
break;
case eSpeculativeLoadNoModuleScript:
aExecutor->PreloadScript(
mUrlOrSizes, mCharsetOrSrcset,
mTypeOrCharsetSourceOrDocumentModeOrMetaCSPOrSizesOrIntegrity,
mCrossOrigin, mMedia, mNonce, mFetchPriority,
mReferrerPolicyOrIntegrity, mScriptReferrerPolicy, false, mIsAsync,
mIsDefer, true, mIsLinkPreload);
break;
case eSpeculativeLoadNoModuleScriptFromHead:
aExecutor->PreloadScript(
mUrlOrSizes, mCharsetOrSrcset,
mTypeOrCharsetSourceOrDocumentModeOrMetaCSPOrSizesOrIntegrity,
mCrossOrigin, mMedia, mNonce, mFetchPriority,
mReferrerPolicyOrIntegrity, mScriptReferrerPolicy, true, mIsAsync,
mIsDefer, true, mIsLinkPreload);
mIsDefer, mIsLinkPreload);
break;
case eSpeculativeLoadStyle:
aExecutor->PreloadStyle(

Просмотреть файл

@ -24,8 +24,6 @@ enum eHtml5SpeculativeLoad {
eSpeculativeLoadPictureSource,
eSpeculativeLoadScript,
eSpeculativeLoadScriptFromHead,
eSpeculativeLoadNoModuleScript,
eSpeculativeLoadNoModuleScriptFromHead,
eSpeculativeLoadStyle,
eSpeculativeLoadManifest,
eSpeculativeLoadSetDocumentCharset,
@ -170,17 +168,11 @@ class nsHtml5SpeculativeLoad {
nsHtml5String aMedia, nsHtml5String aNonce,
nsHtml5String aFetchPriority, nsHtml5String aIntegrity,
nsHtml5String aReferrerPolicy, bool aParserInHead,
bool aAsync, bool aDefer, bool aNoModule,
bool aLinkPreload) {
bool aAsync, bool aDefer, bool aLinkPreload) {
MOZ_ASSERT(mOpCode == eSpeculativeLoadUninitialized,
"Trying to reinitialize a speculative load!");
if (aNoModule) {
mOpCode = aParserInHead ? eSpeculativeLoadNoModuleScriptFromHead
: eSpeculativeLoadNoModuleScript;
} else {
mOpCode = aParserInHead ? eSpeculativeLoadScriptFromHead
: eSpeculativeLoadScript;
}
mOpCode =
aParserInHead ? eSpeculativeLoadScriptFromHead : eSpeculativeLoadScript;
aUrl.ToString(mUrlOrSizes);
aCharset.ToString(mCharsetOrSrcset);
aType.ToString(

Просмотреть файл

@ -2479,9 +2479,9 @@ void nsHtml5StreamParser::ParseAvailableData() {
MarkAsBroken(rv);
return;
}
if (mTreeBuilder->HasScript()) {
// HasScript() cannot return true if the tree builder is preventing
// script execution.
if (mTreeBuilder->HasScriptThatMayDocumentWriteOrBlock()) {
// `HasScriptThatMayDocumentWriteOrBlock()` cannot return true if the
// tree builder is preventing script execution.
MOZ_ASSERT(mMode == NORMAL);
mozilla::MutexAutoLock speculationAutoLock(mSpeculationMutex);
nsHtml5Speculation* speculation = new nsHtml5Speculation(

Просмотреть файл

@ -4615,7 +4615,7 @@ bool nsHtml5TreeBuilder::snapshotMatches(nsAHtml5TreeBuilderState* snapshot) {
}
void nsHtml5TreeBuilder::loadState(nsAHtml5TreeBuilderState* snapshot) {
mCurrentHtmlScriptIsAsyncOrDefer = false;
mCurrentHtmlScriptCannotDocumentWriteOrBlock = false;
jArray<nsHtml5StackNode*, int32_t> stackCopy = snapshot->getStack();
int32_t stackLen = snapshot->getStackLength();
jArray<nsHtml5StackNode*, int32_t> listCopy =

Просмотреть файл

@ -45,7 +45,7 @@ nsHtml5TreeBuilder::nsHtml5TreeBuilder(nsHtml5OplessBuilder* aBuilder)
mHandlesUsed(0),
mSpeculativeLoadStage(nullptr),
mBroken(NS_OK),
mCurrentHtmlScriptIsAsyncOrDefer(false),
mCurrentHtmlScriptCannotDocumentWriteOrBlock(false),
mPreventScriptExecution(false),
mGenerateSpeculativeLoads(false),
mHasSeenImportMap(false)
@ -87,7 +87,7 @@ nsHtml5TreeBuilder::nsHtml5TreeBuilder(nsAHtml5TreeOpSink* aOpSink,
mHandlesUsed(0),
mSpeculativeLoadStage(aStage),
mBroken(NS_OK),
mCurrentHtmlScriptIsAsyncOrDefer(false),
mCurrentHtmlScriptCannotDocumentWriteOrBlock(false),
mPreventScriptExecution(false),
mGenerateSpeculativeLoads(aGenerateSpeculativeLoads),
mHasSeenImportMap(false)
@ -234,44 +234,113 @@ nsIContentHandle* nsHtml5TreeBuilder::createElement(
aAttributes->getValue(nsHtml5AttributeName::ATTR_TYPE);
nsAutoString typeString;
type.ToString(typeString);
if (!mHasSeenImportMap) {
// Since `typeString` after trimming and lowercasing is only checked
// for "module" and " importmap", we don't need to remember
// pre-trimming emptiness here.
// ASCII whitespace https://infra.spec.whatwg.org/#ascii-whitespace:
// U+0009 TAB, U+000A LF, U+000C FF, U+000D CR, or U+0020 SPACE.
static const char kASCIIWhitespace[] = "\t\n\f\r ";
typeString.Trim(kASCIIWhitespace);
bool isModule = typeString.LowerCaseEqualsASCII("module");
bool importmap = typeString.LowerCaseEqualsASCII("importmap");
bool async = false;
bool defer = false;
bool nomodule =
aAttributes->contains(nsHtml5AttributeName::ATTR_NOMODULE);
// For microtask semantics, we need to queue either
// `opRunScriptThatMayDocumentWriteOrBlock` or
// `opRunScriptThatCannotDocumentWriteOrBlock` for every script
// element--even ones that we already know won't run.
// `mCurrentHtmlScriptCannotDocumentWriteOrBlock` controls which
// kind of operation is used for an HTML script, and this is the
// place where `mCurrentHtmlScriptCannotDocumentWriteOrBlock`
// needs to be set correctly.
//
// Non-async, non-defer classic scripts that will run MUST use
// `opRunScriptThatMayDocumentWriteOrBlock` in order to run
// the more complex code that
// 1. is able to resume the HTML parse after a parser-blocking
// scripts no longer blocks the parser
// 2. is able to receive more content to parse on the main thread
// via document.write
// 3. is able to throw away off-the-main-thread parsing results
// if what's document.written on the main thread invalidates
// the speculation.
//
// Async and defer classic scripts as well as module scripts and
// importmaps MUST use `opRunScriptThatCannotDocumentWriteOrBlock`.
// This is necessary particularly because the relevant main-thread
// code assumes it doesn't need to deal with resuming the HTML
// parse some time afterwards, so using a tree operation with
// mismatching expectations regarding that responsibility may
// cause the HTML parse to stall.
//
// Various scripts that won't actually run work with either type
// of tree op in the sense that the HTML parse won't stall.
// However, in the case where a script cannot block or insert
// data to the HTML parser via document.write, unnecessary use
// of `opRunScriptThatMayDocumentWriteOrBlock` instead of
// `opRunScriptThatCannotDocumentWriteOrBlock` causes the HTML
// parser to enter the speculative mode when doing so isn't
// actually required.
//
// Ideally, we would check for `type`/`language` attribute
// combinations that are known to cause non-execution as well as
// ScriptLoader::IsScriptEventHandler equivalent. That way, we
// wouldn't unnecessarily speculate after scripts that won't
// execute. https://bugzilla.mozilla.org/show_bug.cgi?id=1848311
if (importmap) {
// If we see an importmap, we don't want to later start speculative
// loads for modulepreloads, since such load might finish before
// the importmap is created. This also applies to module scripts so
// that any modulepreload integrity checks can be performed before
// the modules scripts are loaded.
mHasSeenImportMap =
typeString.LowerCaseFindASCII("importmap") != kNotFound;
// This state is not part of speculation rollback: If an importmap
// is seen speculatively and the speculation is rolled back, the
// importmap is still considered seen.
// TODO: Sync importmap seenness between the main thread and the
// parser thread.
// https://bugzilla.mozilla.org/show_bug.cgi?id=1848312
mHasSeenImportMap = true;
}
nsHtml5String url =
aAttributes->getValue(nsHtml5AttributeName::ATTR_SRC);
if (url && !(mHasSeenImportMap &&
typeString.LowerCaseFindASCII("module") != kNotFound)) {
nsHtml5String charset =
aAttributes->getValue(nsHtml5AttributeName::ATTR_CHARSET);
nsHtml5String crossOrigin =
aAttributes->getValue(nsHtml5AttributeName::ATTR_CROSSORIGIN);
nsHtml5String nonce =
aAttributes->getValue(nsHtml5AttributeName::ATTR_NONCE);
nsHtml5String fetchPriority =
aAttributes->getValue(nsHtml5AttributeName::ATTR_FETCHPRIORITY);
nsHtml5String integrity =
aAttributes->getValue(nsHtml5AttributeName::ATTR_INTEGRITY);
nsHtml5String referrerPolicy = aAttributes->getValue(
nsHtml5AttributeName::ATTR_REFERRERPOLICY);
bool async =
aAttributes->contains(nsHtml5AttributeName::ATTR_ASYNC);
bool defer =
aAttributes->contains(nsHtml5AttributeName::ATTR_DEFER);
bool noModule =
aAttributes->contains(nsHtml5AttributeName::ATTR_NOMODULE);
mSpeculativeLoadQueue.AppendElement()->InitScript(
url, charset, type, crossOrigin, /* aMedia = */ nullptr, nonce,
fetchPriority, integrity, referrerPolicy,
mode == nsHtml5TreeBuilder::IN_HEAD, async, defer, noModule,
false);
mCurrentHtmlScriptIsAsyncOrDefer = async || defer;
if (url) {
async = aAttributes->contains(nsHtml5AttributeName::ATTR_ASYNC);
defer = aAttributes->contains(nsHtml5AttributeName::ATTR_DEFER);
if ((isModule && !mHasSeenImportMap) ||
(!isModule && !importmap && !nomodule)) {
nsHtml5String charset =
aAttributes->getValue(nsHtml5AttributeName::ATTR_CHARSET);
nsHtml5String crossOrigin =
aAttributes->getValue(nsHtml5AttributeName::ATTR_CROSSORIGIN);
nsHtml5String nonce =
aAttributes->getValue(nsHtml5AttributeName::ATTR_NONCE);
nsHtml5String fetchPriority = aAttributes->getValue(
nsHtml5AttributeName::ATTR_FETCHPRIORITY);
nsHtml5String integrity =
aAttributes->getValue(nsHtml5AttributeName::ATTR_INTEGRITY);
nsHtml5String referrerPolicy = aAttributes->getValue(
nsHtml5AttributeName::ATTR_REFERRERPOLICY);
mSpeculativeLoadQueue.AppendElement()->InitScript(
url, charset, type, crossOrigin, /* aMedia = */ nullptr,
nonce, fetchPriority, integrity, referrerPolicy,
mode == nsHtml5TreeBuilder::IN_HEAD, async, defer, false);
}
}
// `mCurrentHtmlScriptCannotDocumentWriteOrBlock` MUST be computed to
// match the ScriptLoader-perceived kind of the script regardless of
// enqueuing a speculative load. Scripts with the `nomodule` attribute
// never block or document.write: Either the attribute prevents a
// classic script execution or is ignored on a module script or
// importmap.
mCurrentHtmlScriptCannotDocumentWriteOrBlock =
isModule || importmap || async || defer || nomodule;
} else if (nsGkAtoms::link == aName) {
nsHtml5String rel =
aAttributes->getValue(nsHtml5AttributeName::ATTR_REL);
@ -348,7 +417,7 @@ nsIContentHandle* nsHtml5TreeBuilder::createElement(
url, charset, type, crossOrigin, media, nonce,
/* aFetchPriority */ fetchPriority, integrity,
referrerPolicy, mode == nsHtml5TreeBuilder::IN_HEAD,
false, false, false, true);
false, false, true);
} else if (as.LowerCaseEqualsASCII("style")) {
mSpeculativeLoadQueue.AppendElement()->InitStyle(
url, charset, crossOrigin, media, referrerPolicy, nonce,
@ -408,7 +477,7 @@ nsIContentHandle* nsHtml5TreeBuilder::createElement(
url, charset, type, crossOrigin, media, nonce,
/* aFetchPriority */ fetchPriority, integrity,
referrerPolicy, mode == nsHtml5TreeBuilder::IN_HEAD,
false, false, false, true);
false, false, true);
}
}
}
@ -517,8 +586,7 @@ nsIContentHandle* nsHtml5TreeBuilder::createElement(
mSpeculativeLoadQueue.AppendElement()->InitScript(
url, nullptr, type, crossOrigin, /* aMedia = */ nullptr, nonce,
fetchPriority, integrity, referrerPolicy,
mode == nsHtml5TreeBuilder::IN_HEAD, false, false, false,
false);
mode == nsHtml5TreeBuilder::IN_HEAD, false, false, false);
}
} else if (nsGkAtoms::style == aName) {
mImportScanner.Start();
@ -554,10 +622,44 @@ nsIContentHandle* nsHtml5TreeBuilder::createElement(
content, tokenizer->getLineNumber(), tokenizer->getColumnNumber());
treeOp->Init(mozilla::AsVariant(operation));
if (aNamespace == kNameSpaceID_XHTML) {
mCurrentHtmlScriptIsAsyncOrDefer =
aAttributes->contains(nsHtml5AttributeName::ATTR_SRC) &&
(aAttributes->contains(nsHtml5AttributeName::ATTR_ASYNC) ||
aAttributes->contains(nsHtml5AttributeName::ATTR_DEFER));
// Although we come here in cases where the value of
// `mCurrentHtmlScriptCannotDocumentWriteOrBlock` doesn't actually
// matter, we also come here when parsing document.written content on
// the main thread. In that case, IT MATTERS that
// `mCurrentHtmlScriptCannotDocumentWriteOrBlock` is set correctly,
// so let's just always set it correctly even if it a bit of wasted work
// in the scenarios where no scripts execute and it doesn't matter.
//
// See the comments around generating speculative loads for HTML scripts
// elements for the details of when
// `mCurrentHtmlScriptCannotDocumentWriteOrBlock` needs to be set to
// `true` and when to `false`.
nsHtml5String type =
aAttributes->getValue(nsHtml5AttributeName::ATTR_TYPE);
nsAutoString typeString;
type.ToString(typeString);
// Since `typeString` after trimming and lowercasing is only checked
// for "module" and " importmap", we don't need to remember
// pre-trimming emptiness here.
// ASCII whitespace https://infra.spec.whatwg.org/#ascii-whitespace:
// U+0009 TAB, U+000A LF, U+000C FF, U+000D CR, or U+0020 SPACE.
static const char kASCIIWhitespace[] = "\t\n\f\r ";
typeString.Trim(kASCIIWhitespace);
mCurrentHtmlScriptCannotDocumentWriteOrBlock =
typeString.LowerCaseEqualsASCII("module") ||
typeString.LowerCaseEqualsASCII("nomodule") ||
typeString.LowerCaseEqualsASCII("importmap");
if (!mCurrentHtmlScriptCannotDocumentWriteOrBlock &&
aAttributes->contains(nsHtml5AttributeName::ATTR_SRC)) {
mCurrentHtmlScriptCannotDocumentWriteOrBlock =
(aAttributes->contains(nsHtml5AttributeName::ATTR_ASYNC) ||
aAttributes->contains(nsHtml5AttributeName::ATTR_DEFER));
}
}
} else if (aNamespace == kNameSpaceID_XHTML) {
if (nsGkAtoms::html == aName) {
@ -989,7 +1091,7 @@ void nsHtml5TreeBuilder::markMalformedIfScript(nsIContentHandle* aElement) {
}
void nsHtml5TreeBuilder::start(bool fragment) {
mCurrentHtmlScriptIsAsyncOrDefer = false;
mCurrentHtmlScriptCannotDocumentWriteOrBlock = false;
#ifdef DEBUG
mActive = true;
#endif
@ -1121,7 +1223,7 @@ void nsHtml5TreeBuilder::elementPopped(int32_t aNamespace, nsAtom* aName,
if (mBuilder) {
return;
}
if (mCurrentHtmlScriptIsAsyncOrDefer) {
if (mCurrentHtmlScriptCannotDocumentWriteOrBlock) {
NS_ASSERTION(aNamespace == kNameSpaceID_XHTML,
"Only HTML scripts may be async/defer.");
nsHtml5TreeOperation* treeOp = mOpQueue.AppendElement(mozilla::fallible);
@ -1129,9 +1231,9 @@ void nsHtml5TreeBuilder::elementPopped(int32_t aNamespace, nsAtom* aName,
MarkAsBrokenAndRequestSuspensionWithoutBuilder(NS_ERROR_OUT_OF_MEMORY);
return;
}
opRunScriptAsyncDefer operation(aElement);
opRunScriptThatCannotDocumentWriteOrBlock operation(aElement);
treeOp->Init(mozilla::AsVariant(operation));
mCurrentHtmlScriptIsAsyncOrDefer = false;
mCurrentHtmlScriptCannotDocumentWriteOrBlock = false;
return;
}
requestSuspension();
@ -1140,7 +1242,7 @@ void nsHtml5TreeBuilder::elementPopped(int32_t aNamespace, nsAtom* aName,
MarkAsBrokenAndRequestSuspensionWithoutBuilder(NS_ERROR_OUT_OF_MEMORY);
return;
}
opRunScript operation(aElement, nullptr);
opRunScriptThatMayDocumentWriteOrBlock operation(aElement, nullptr);
treeOp->Init(mozilla::AsVariant(operation));
return;
}
@ -1285,12 +1387,12 @@ nsIContentHandle* nsHtml5TreeBuilder::AllocateContentHandle() {
return &mHandles[mHandlesUsed++];
}
bool nsHtml5TreeBuilder::HasScript() {
bool nsHtml5TreeBuilder::HasScriptThatMayDocumentWriteOrBlock() {
uint32_t len = mOpQueue.Length();
if (!len) {
return false;
}
return mOpQueue.ElementAt(len - 1).IsRunScript();
return mOpQueue.ElementAt(len - 1).IsRunScriptThatMayDocumentWriteOrBlock();
}
mozilla::Result<bool, nsresult> nsHtml5TreeBuilder::Flush(bool aDiscretionary) {
@ -1427,7 +1529,8 @@ void nsHtml5TreeBuilder::AddSnapshotToScript(
MOZ_ASSERT_UNREACHABLE("Must never use snapshots with builder.");
return;
}
MOZ_ASSERT(HasScript(), "No script to add a snapshot to!");
MOZ_ASSERT(HasScriptThatMayDocumentWriteOrBlock(),
"No script to add a snapshot to!");
MOZ_ASSERT(aSnapshot, "Got null snapshot.");
mOpQueue.ElementAt(mOpQueue.Length() - 1).SetSnapshot(aSnapshot, aLine);
}

Просмотреть файл

@ -23,7 +23,18 @@ int32_t mHandlesUsed;
nsTArray<mozilla::UniquePtr<nsIContent*[]>> mOldHandles;
nsHtml5TreeOpStage* mSpeculativeLoadStage;
nsresult mBroken;
bool mCurrentHtmlScriptIsAsyncOrDefer;
// Controls whether the current HTML script goes through the more complex
// path that accommodates the possibility of the script becoming a
// parser-blocking script and the possibility of the script inserting
// content into this parse using document.write (as it is observable from
// the Web).
//
// Notably, in some cases scripts that do NOT NEED the more complex path
// BREAK the parse if they incorrectly go onto the complex path as their
// other handling doesn't necessarily take care of the responsibilities
// associated with the more complex path. See comments in
// `nsHtml5TreeBuilder::createElement` in the CppSupplement for details.
bool mCurrentHtmlScriptCannotDocumentWriteOrBlock;
bool mPreventScriptExecution;
/**
* Whether to actually generate speculative load operations that actually
@ -106,7 +117,7 @@ void StartPlainText();
void StartPlainTextBody();
bool HasScript();
bool HasScriptThatMayDocumentWriteOrBlock();
void SetOpSink(nsAHtml5TreeOpSink* aOpSink) { mOpSink = aOpSink; }

Просмотреть файл

@ -738,7 +738,7 @@ void nsHtml5TreeOpExecutor::RunFlushLoop() {
#endif
} else if (scriptElement) {
// must be tail call when mFlushState is eNotFlushing
RunScript(scriptElement);
RunScript(scriptElement, true);
// Always check the clock in nsContentSink right after a script
StopDeflecting();
@ -843,7 +843,7 @@ nsresult nsHtml5TreeOpExecutor::FlushDocumentWrite() {
#endif
} else if (scriptElement) {
// must be tail call when mFlushState is eNotFlushing
RunScript(scriptElement);
RunScript(scriptElement, true);
}
return rv;
}
@ -909,12 +909,13 @@ void nsHtml5TreeOpExecutor::PauseDocUpdate(bool* aInterrupted) {
* before scripts run. This way, the tokenizer is not invoked re-entrantly
* although the parser is.
*
* The reason why this is called as a tail call when mFlushState is set to
* eNotFlushing is to allow re-entry to Flush() but only after the current
* Flush() has cleared the op queue and is otherwise done cleaning up after
* itself.
* The reason why this is called with `aMayDocumentWriteOrBlock=true` as a
* tail call when `mFlushState` is set to `eNotFlushing` is to allow re-entry
* to `Flush()` but only after the current `Flush()` has cleared the op queue
* and is otherwise done cleaning up after itself.
*/
void nsHtml5TreeOpExecutor::RunScript(nsIContent* aScriptElement) {
void nsHtml5TreeOpExecutor::RunScript(nsIContent* aScriptElement,
bool aMayDocumentWriteOrBlock) {
if (mRunsToCompletion) {
// We are in createContextualFragment() or in the upcoming document.parse().
// Do nothing. Let's not even mark scripts malformed here, because that
@ -931,19 +932,24 @@ void nsHtml5TreeOpExecutor::RunScript(nsIContent* aScriptElement) {
return;
}
if (sele->GetScriptDeferred() || sele->GetScriptAsync()) {
sele->SetCreatorParser(GetParser());
if (!aMayDocumentWriteOrBlock) {
MOZ_ASSERT(sele->GetScriptDeferred() || sele->GetScriptAsync() ||
sele->GetScriptIsModule() || sele->GetScriptIsImportMap() ||
aScriptElement->AsElement()->HasAttr(nsGkAtoms::nomodule));
DebugOnly<bool> block = sele->AttemptToExecute();
NS_ASSERTION(!block, "Defer or async script tried to block.");
MOZ_ASSERT(!block,
"Defer, async, module, importmap, or nomodule tried to block.");
return;
}
MOZ_RELEASE_ASSERT(mFlushState == eNotFlushing,
"Tried to run script while flushing.");
MOZ_RELEASE_ASSERT(
mFlushState == eNotFlushing,
"Tried to run a potentially-blocking script while flushing.");
mReadingFromStage = false;
sele->SetCreatorParser(GetParser());
// Copied from nsXMLContentSink
// Now tell the script that it's ready to go. This may execute the script
// or return true, or neither if the script doesn't need executing.
@ -1207,8 +1213,7 @@ void nsHtml5TreeOpExecutor::PreloadScript(
const nsAString& aCrossOrigin, const nsAString& aMedia,
const nsAString& aNonce, const nsAString& aFetchPriority,
const nsAString& aIntegrity, dom::ReferrerPolicy aReferrerPolicy,
bool aScriptFromHead, bool aAsync, bool aDefer, bool aNoModule,
bool aLinkPreload) {
bool aScriptFromHead, bool aAsync, bool aDefer, bool aLinkPreload) {
nsCOMPtr<nsIURI> uri = ConvertIfNotPreloadedYetAndMediaApplies(aURL, aMedia);
if (!uri) {
return;
@ -1219,7 +1224,7 @@ void nsHtml5TreeOpExecutor::PreloadScript(
}
mDocument->ScriptLoader()->PreloadURI(
uri, aCharset, aType, aCrossOrigin, aNonce, aFetchPriority, aIntegrity,
aScriptFromHead, aAsync, aDefer, aNoModule, aLinkPreload,
aScriptFromHead, aAsync, aDefer, aLinkPreload,
GetPreloadReferrerPolicy(aReferrerPolicy), 0);
}

Просмотреть файл

@ -216,7 +216,7 @@ class nsHtml5TreeOpExecutor final
bool IsInFlushLoop() { return mRunFlushLoopOnStack; }
#endif
void RunScript(nsIContent* aScriptElement);
void RunScript(nsIContent* aScriptElement, bool aMayDocumentWriteOrBlock);
/**
* Flush the operations from the tree operations from the argument
@ -249,8 +249,7 @@ class nsHtml5TreeOpExecutor final
const nsAString& aFetchPriority,
const nsAString& aIntegrity,
ReferrerPolicy aReferrerPolicy, bool aScriptFromHead,
bool aAsync, bool aDefer, bool aNoModule,
bool aLinkPreload);
bool aAsync, bool aDefer, bool aLinkPreload);
void PreloadStyle(const nsAString& aURL, const nsAString& aCharset,
const nsAString& aCrossOrigin, const nsAString& aMedia,

Просмотреть файл

@ -138,9 +138,10 @@ nsHtml5TreeOperation::~nsHtml5TreeOperation() {
void operator()(const opMarkAsBroken& aOperation) {}
void operator()(const opRunScript& aOperation) {}
void operator()(const opRunScriptThatMayDocumentWriteOrBlock& aOperation) {}
void operator()(const opRunScriptAsyncDefer& aOperation) {}
void operator()(
const opRunScriptThatCannotDocumentWriteOrBlock& aOperation) {}
void operator()(const opPreventScriptExecution& aOperation) {}
@ -905,7 +906,8 @@ nsresult nsHtml5TreeOperation::Perform(nsHtml5TreeOpExecutor* aBuilder,
return aOperation.mResult;
}
nsresult operator()(const opRunScript& aOperation) {
nsresult operator()(
const opRunScriptThatMayDocumentWriteOrBlock& aOperation) {
nsIContent* node = *(aOperation.mElement);
nsAHtml5TreeBuilderState* snapshot = aOperation.mBuilderState;
if (snapshot) {
@ -916,8 +918,9 @@ nsresult nsHtml5TreeOperation::Perform(nsHtml5TreeOpExecutor* aBuilder,
return NS_OK;
}
nsresult operator()(const opRunScriptAsyncDefer& aOperation) {
mBuilder->RunScript(*(aOperation.mElement));
nsresult operator()(
const opRunScriptThatCannotDocumentWriteOrBlock& aOperation) {
mBuilder->RunScript(*(aOperation.mElement), false);
return NS_OK;
}

Просмотреть файл

@ -285,22 +285,23 @@ struct opMarkAsBroken {
explicit opMarkAsBroken(nsresult aResult) : mResult(aResult){};
};
struct opRunScript {
struct opRunScriptThatMayDocumentWriteOrBlock {
nsIContent** mElement;
nsAHtml5TreeBuilderState* mBuilderState;
int32_t mLineNumber;
explicit opRunScript(nsIContentHandle* aElement,
nsAHtml5TreeBuilderState* aBuilderState)
explicit opRunScriptThatMayDocumentWriteOrBlock(
nsIContentHandle* aElement, nsAHtml5TreeBuilderState* aBuilderState)
: mBuilderState(aBuilderState), mLineNumber(0) {
mElement = static_cast<nsIContent**>(aElement);
};
};
struct opRunScriptAsyncDefer {
struct opRunScriptThatCannotDocumentWriteOrBlock {
nsIContent** mElement;
explicit opRunScriptAsyncDefer(nsIContentHandle* aElement) {
explicit opRunScriptThatCannotDocumentWriteOrBlock(
nsIContentHandle* aElement) {
mElement = static_cast<nsIContent**>(aElement);
};
};
@ -493,11 +494,12 @@ typedef mozilla::Variant<
opAppendCommentToDocument, opAppendDoctypeToDocument,
opGetDocumentFragmentForTemplate, opGetFosterParent,
// Gecko-specific on-pop ops
opMarkAsBroken, opRunScript, opRunScriptAsyncDefer,
opPreventScriptExecution, opDoneAddingChildren, opDoneCreatingElement,
opUpdateCharsetSource, opCharsetSwitchTo, opUpdateStyleSheet,
opProcessOfflineManifest, opMarkMalformedIfScript, opStreamEnded,
opSetStyleLineNumber, opSetScriptLineAndColumnNumberAndFreeze, opSvgLoad,
opMarkAsBroken, opRunScriptThatMayDocumentWriteOrBlock,
opRunScriptThatCannotDocumentWriteOrBlock, opPreventScriptExecution,
opDoneAddingChildren, opDoneCreatingElement, opUpdateCharsetSource,
opCharsetSwitchTo, opUpdateStyleSheet, opProcessOfflineManifest,
opMarkMalformedIfScript, opStreamEnded, opSetStyleLineNumber,
opSetScriptLineAndColumnNumberAndFreeze, opSvgLoad,
opMaybeComplainAboutCharset, opMaybeComplainAboutDeepTree, opAddClass,
opAddViewSourceHref, opAddViewSourceBase, opAddErrorType, opAddLineNumberId,
opStartLayout, opEnableEncodingMenu>
@ -609,16 +611,19 @@ class nsHtml5TreeOperation final {
mOperation = aOperation;
}
inline bool IsRunScript() { return mOperation.is<opRunScript>(); }
inline bool IsRunScriptThatMayDocumentWriteOrBlock() {
return mOperation.is<opRunScriptThatMayDocumentWriteOrBlock>();
}
inline bool IsMarkAsBroken() { return mOperation.is<opMarkAsBroken>(); }
inline void SetSnapshot(nsAHtml5TreeBuilderState* aSnapshot, int32_t aLine) {
NS_ASSERTION(
IsRunScript(),
MOZ_ASSERT(
IsRunScriptThatMayDocumentWriteOrBlock(),
"Setting a snapshot for a tree operation other than eTreeOpRunScript!");
MOZ_ASSERT(aSnapshot, "Initialized tree op with null snapshot.");
opRunScript data = mOperation.as<opRunScript>();
opRunScriptThatMayDocumentWriteOrBlock data =
mOperation.as<opRunScriptThatMayDocumentWriteOrBlock>();
data.mBuilderState = aSnapshot;
data.mLineNumber = aLine;
mOperation = mozilla::AsVariant(data);

Просмотреть файл

@ -1,7 +1,5 @@
[after-prepare-iframe-fetch-error-external-classic.html]
[<script> error: Move fetch-error external classic script to iframe after-prepare]
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1849107
expected:
if (os == "android") and debug and swgl: [FAIL, PASS]
if (os == "android") and debug and not swgl: [FAIL, PASS]
if (os == "android") and not debug: [FAIL, PASS]
FAIL
[FAIL, PASS]

Просмотреть файл

@ -1,6 +1,5 @@
[after-prepare-iframe-fetch-error-external-module.html]
[<script> error: Move fetch-error external module script to iframe after-prepare]
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1849107
expected:
if (os == "android") and not swgl: [FAIL, PASS]
if (os == "android") and swgl: [FAIL, PASS]
FAIL
[FAIL, PASS]

Просмотреть файл

@ -0,0 +1,28 @@
<html>
<head>
<title>Inline async module script without external deps onload blocking</title>
<meta name=timeout content=long>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<script>
let loadFired = false;
let moduleRan = false
let test = async_test("Inline async module script vs. onload");
window.addEventListener("load", test.step_func(function() {
loadFired = true;
assert_true(moduleRan, "Module should have run before the load event");
test.step_timeout(function() {
test.done();
}, 0);
}));
</script>
<script type="module" async>
moduleRan = true;
test.step_func(function() {
assert_false(loadFired, "onload should not have fired yet");
});
</script>
</body>
</html>

Просмотреть файл

@ -0,0 +1,29 @@
<html>
<head>
<title>Inline defer module script without external deps onload blocking</title>
<meta name=timeout content=long>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<script>
let loadFired = false;
let moduleRan = false
let test = async_test("Inline defer module script vs. onload");
window.addEventListener("load", test.step_func(function() {
loadFired = true;
assert_true(moduleRan, "Module should have run before the load event");
test.step_timeout(function() {
test.done();
}, 0);
}));
</script>
<!-- defer should be equivalent to neither defer nor async specified -->
<script type="module" defer>
moduleRan = true;
test.step_func(function() {
assert_false(loadFired, "onload should not have fired yet");
});
</script>
</body>
</html>

Просмотреть файл

@ -0,0 +1,28 @@
<html>
<head>
<title>Inline module script without external deps onload blocking</title>
<meta name=timeout content=long>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<script>
let loadFired = false;
let moduleRan = false
let test = async_test("Inline module script vs. onload");
window.addEventListener("load", test.step_func(function() {
loadFired = true;
assert_true(moduleRan, "Module should have run before the load event");
test.step_timeout(function() {
test.done();
}, 0);
}));
</script>
<script type="module">
moduleRan = true;
test.step_func(function() {
assert_false(loadFired, "onload should not have fired yet");
});
</script>
</body>
</html>

Просмотреть файл

@ -219,7 +219,7 @@ void PreloadService::PreloadScript(
uint64_t aEarlyHintPreloaderId) {
mDocument->ScriptLoader()->PreloadURI(
aURI, aCharset, aType, aCrossOrigin, aNonce, aFetchPriority, aIntegrity,
aScriptFromHead, false, false, false, true,
aScriptFromHead, false, false, true,
PreloadReferrerPolicy(aReferrerPolicy), aEarlyHintPreloaderId);
}