Open Bug 1968903 Opened 5 months ago Updated 10 hours ago

Avoid creating script and CSS loaders for documents loaded as data

Categories

(Core :: DOM: Core & HTML, enhancement)

enhancement

Tracking

()

REOPENED

People

(Reporter: hsivonen, Assigned: hsivonen)

References

(Blocks 4 open bugs, Regressed 1 open bug)

Details

Crash Data

Attachments

(1 file)

It seems that loadedAsData=true docs never become loadedAsData=false. Therefore, it seems feasible to pursue not creating script and CSS loaders for them in order to speed up creation from DOMParser.

It turns out that print preview wants a document that counts as loaded as data but can be styled and rendered.

Emilio, is print preview a special case where the browser has special powers and can be addressed as a special case, or is it possible to start styling and displaying a loaded-as-data document using Web-exposed APIs?

Flags: needinfo?(emilio)

Static clones for both print preview and printing need styling, yeah. I think SVG-as-image also counts as loaded-as-data? But with those special cases out of the way I think you're good to go.

Flags: needinfo?(emilio)

(In reply to Emilio Cobos Álvarez (:emilio) from comment #5)

Static clones for both print preview and printing need styling, yeah. I think SVG-as-image also counts as loaded-as-data? But with those special cases out of the way I think you're good to go.

Thanks. Some SVG cases that one might expect to be loaded-as-data already aren't. Let's see what happens with allowing styling from clone but not otherwise:

https://treeherder.mozilla.org/jobs?repo=try&landoCommitID=151846

Depends on: 1911633
No longer depends on: 1911633
Blocks: 1911633
Attachment #9513198 - Attachment description: WIP: Bug 1968903 - Avoid creating script and CSS loaders for documents loaded as data. r?smaug! → WIP: Bug 1968903 - Avoid creating script and CSS loaders for documents loaded as data. r?emilio!
Attachment #9513198 - Attachment description: WIP: Bug 1968903 - Avoid creating script and CSS loaders for documents loaded as data. r?emilio! → Bug 1968903 - Avoid creating script and CSS loaders for documents loaded as data. r?emilio!
Blocks: 1991609
Pushed by hsivonen@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/f83cb2878925 https://hg.mozilla.org/integration/autoland/rev/58ff60616c74 Avoid creating script and CSS loaders for documents loaded as data. r=firefox-style-system-reviewers,emilio,layout-reviewers
Blocks: 1991630
Pushed by agoloman@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/0a11d7413f2e https://hg.mozilla.org/integration/autoland/rev/958717d69d7a Revert "Bug 1968903 - Avoid creating script and CSS loaders for documents loaded as data. r=firefox-style-system-reviewers,emilio,layout-reviewers" for causing multiple wpt failures.

Backed out for causing multiple wpt failures.

Flags: needinfo?(hsivonen)
Pushed by pstanciu@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/6cbdfe15a061 https://hg.mozilla.org/integration/autoland/rev/c5b047ab1e56 Avoid creating script and CSS loaders for documents loaded as data. r=firefox-style-system-reviewers,emilio,layout-reviewers

Relanded because it was not the actual culprit.

Flags: needinfo?(hsivonen)
Status: NEW → RESOLVED
Closed: 20 days ago
Resolution: --- → FIXED
Target Milestone: --- → 145 Branch
Regressions: 1991793
Regressions: 1991800
Pushed by chorotan@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/f21b53b7045f https://hg.mozilla.org/mozilla-central/rev/75a595a9d65d Revert "Bug 1968903 - Avoid creating script and CSS loaders for documents loaded as data. r=firefox-style-system-reviewers,emilio,layout-reviewers" for causing bug 1991800
Status: RESOLVED → REOPENED
Flags: needinfo?(hsivonen)
Resolution: FIXED → ---
Target Milestone: 145 Branch → ---

Let's use bug 1991800 for investigation.

Flags: needinfo?(hsivonen)

There are 6 crash reports from 2 installs of the latest Nightly with [@ mozilla::dom::ScriptLoader::AddParserBlockingScriptExecutionBlocker ] as signature, e.g. bp-4db92bb6-dfaa-4613-9323-fe6960251001. If these were a result of bug 1991800, there should be more reports.

Crash Signature: [@ mozilla::dom::ScriptLoader::AddParserBlockingScriptExecutionBlocker ]

(In reply to Sebastian Hengst [:aryx] (needinfo me if it's about an intermittent or backout) from comment #22)

There are 6 crash reports from 2 installs of the latest Nightly with [@ mozilla::dom::ScriptLoader::AddParserBlockingScriptExecutionBlocker ] as signature, e.g. bp-4db92bb6-dfaa-4613-9323-fe6960251001. If these were a result of bug 1991800, there should be more reports.

Thanks! This is a null check oversight.

Attachment #9513198 - Attachment description: Bug 1968903 - Avoid creating script and CSS loaders for documents loaded as data. r?emilio! → WIP: Bug 1968903 - Avoid creating script and CSS loaders for documents loaded as data. r?emilio!

layout/base/tests/chrome/printpreview_pps9.html fails with the current patch even though other print preview cases pass. Emilio, do you see some obvious reason that could make that one fail when the others don't fail?

Flags: needinfo?(emilio)

(The current state of the patch accomplishes the goal on Speedometer3 of not creating the CSS loader for loaded-as-data docs during the Speedometer3 run.)

Not sure but it seems the patch is pretty orange, so that might have to do with it.

Flags: needinfo?(emilio)

Maybe that's not using quirks mode and the others do? But just guessing really.

(In reply to Emilio Cobos Álvarez [:emilio] from comment #27)

Not sure but it seems the patch is pretty orange, so that might have to do with it.

Whoa. The patch went really bad in my latest tweak that was supposed to be an easy fix.

(In reply to Henri Sivonen (:hsivonen) from comment #30)

https://treeherder.mozilla.org/jobs?repo=try&landoCommitID=158062

This run is considerably less orange. With this code, layout/base/tests/chrome/printpreview_pps9.html still fails for me locally. Furthermore, even if I try to cause more eager creation of the CSS loader from DocumentOrShadowRoot::CloneAdoptedSheetsFrom, layout/base/tests/chrome/printpreview_pps9.html still fails locally here.

(In reply to Henri Sivonen (:hsivonen) from comment #31)

(In reply to Henri Sivonen (:hsivonen) from comment #30)

https://treeherder.mozilla.org/jobs?repo=try&landoCommitID=158062

This run is considerably less orange. With this code, layout/base/tests/chrome/printpreview_pps9.html still fails for me locally. Furthermore, even if I try to cause more eager creation of the CSS loader from DocumentOrShadowRoot::CloneAdoptedSheetsFrom, layout/base/tests/chrome/printpreview_pps9.html still fails locally here.

The null-returning Document::GetExistingCSSLoader look in Pernosco like they are not the cause.

Still fails for me locally even if I cause CSS loader creation in Document::CloneDocHelper right after creating the cloned doc and before the compat mode is set.

It seems that the test now passes on try. OTOH, a test that fails on try passes locally. Probably both are unreliable somehow.

Attachment #9513198 - Attachment description: WIP: Bug 1968903 - Avoid creating script and CSS loaders for documents loaded as data. r?emilio! → Bug 1968903 - Avoid creating script and CSS loaders for documents loaded as data. r?emilio!
Pushed by hsivonen@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/b1685935b1c2 https://hg.mozilla.org/integration/autoland/rev/d6edfd154d6b Avoid creating script and CSS loaders for documents loaded as data. r=firefox-style-system-reviewers,emilio,layout-reviewers
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/55550 for changes under testing/web-platform/tests
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: