RESOLVED FIXED 233706
[Model] Add load and error events to distinguish resource load from model readiness
https://bugs.webkit.org/show_bug.cgi?id=233706
Summary [Model] Add load and error events to distinguish resource load from model rea...
Antoine Quint
Reported 2021-12-01 08:21:06 PST
As it stands <model> elements have a "ready" promise, which resolves once the resource has been loaded. However, this promise should be used when the <model> is fully ready, and this is done on macOS and iOS asynchronously after the resource has been loaded. So we should have "load" and "error" events and a "complete" property to match <img> to identify resource load, and use the "ready" promise for when the model is fully ready and its various APIs safely usable.
Attachments
Patch (24.75 KB, patch)
2021-12-07 08:13 PST, Antoine Quint
no flags
Patch (25.20 KB, patch)
2021-12-07 09:34 PST, Antoine Quint
cdumez: review+
ews-feeder: commit-queue-
Patch for landing (26.34 KB, patch)
2021-12-08 01:33 PST, Antoine Quint
ews-feeder: commit-queue-
Patch for landing (37.92 KB, patch)
2021-12-09 03:14 PST, Antoine Quint
no flags
Patch for landing (42.29 KB, patch)
2021-12-13 13:17 PST, Antoine Quint
no flags
Patch for landing (42.19 KB, patch)
2022-01-23 12:24 PST, Antoine Quint
ews-feeder: commit-queue-
Radar WebKit Bug Importer
Comment 1 2021-12-01 08:21:31 PST
Antoine Quint
Comment 2 2021-12-07 08:13:52 PST
Chris Dumez
Comment 3 2021-12-07 08:27:22 PST
It seems you are not overriding virtualHasPendingActivity() and I believe that is an issue You need to override it to keep the HTMLModelElement JS wrapper alive as long as you may fire load/error events on it queueTaskToDispatchEvent() keeps the JS wrapper alive between the call to queueTaskToDispatchEvent() and the point where the event actually gets fired. However, nothing seems to make sure your JS wrapper says alive until you eventually call queueTaskToDispatchEvent().
Antoine Quint
Comment 4 2021-12-07 09:34:03 PST
Antoine Quint
Comment 5 2021-12-07 09:35:54 PST
(In reply to Chris Dumez from comment #3) > It seems you are not overriding virtualHasPendingActivity() and I believe > that is an issue > > You need to override it to keep the HTMLModelElement JS wrapper alive as > long as you may fire load/error events on it > > queueTaskToDispatchEvent() keeps the JS wrapper alive between the call to > queueTaskToDispatchEvent() and the point where the event actually gets > fired. However, nothing seems to make sure your JS wrapper says alive until > you eventually call queueTaskToDispatchEvent(). Thanks for pointing that out. The new patch has an implementation for virtualHasPendingActivity() and calls suspendIfNeeded() in the create() method.
Chris Dumez
Comment 6 2021-12-07 09:41:23 PST
Comment on attachment 446189 [details] Patch r=me
Antoine Quint
Comment 7 2021-12-08 01:33:26 PST
Created attachment 446333 [details] Patch for landing
Antoine Quint
Comment 8 2021-12-09 03:14:31 PST
Created attachment 446513 [details] Patch for landing
Antoine Quint
Comment 9 2021-12-10 00:15:22 PST
Antoine Quint
Comment 10 2021-12-10 00:19:39 PST
A note to bot watchers: the existing test model-element/model-element-contents-layer-updates-with-clipping.html was modified as part of this patch and the iOS-15-Simulator-WK2-Tests-EWS bot saw flakiness with it as part of the run-layout-tests-in-stress-mode step. Subsequent test runs did not see such an issue. I tried to run the test locally with the iPhone 8 simulator using the iOS 12.2 SDK and did not see an issue running the test with `--ios-simulator --release --iterations=100`. I also tried with `--run-singly`. In case you see some flakiness with this test, please mark it as flaky for now and file a bug so that I may investigate.
Antoine Quint
Comment 11 2021-12-10 00:20:06 PST
That would be the iOS 15.2 SDK, not 12.2.
WebKit Commit Bot
Comment 12 2021-12-10 09:23:52 PST
Re-opened since this is blocked by bug 234153
Antoine Quint
Comment 13 2021-12-10 09:26:33 PST
There two types of failures with the changed or new tests. On iOS, you can see some flakiness by running: run-webkit-tests --no-build --release --ios-simulator --exit-after-n-failures 1 --skip-failing-tests --iterations 100 LayoutTests/model-element/model-element-contents-layer-updates.html LayoutTests/model-element/model-element-contents-layer-updates-with-clipping.html LayoutTests/model-element/model-element-graphics-layers-opacity.html LayoutTests/model-element/model-element-error-and-load-events.html LayoutTests/model-element/model-element-graphics-layers.html LayoutTests/model-element/model-element-ready.html On macOS, you can see some crashes by running: rwt --debug --iterations=100 model-element --exit-after-n-failures=1
Antoine Quint
Comment 14 2021-12-13 13:17:23 PST
Created attachment 447050 [details] Patch for landing
Antoine Quint
Comment 15 2022-01-23 12:24:50 PST
Created attachment 449762 [details] Patch for landing
EWS
Comment 16 2022-01-23 13:51:36 PST
Committed r288424 (246315@main): <https://commits.webkit.org/246315@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 449762 [details].
Note You need to log in before you can comment on or make changes to this bug.