RESOLVED FIXED 200662
Allow checking whether image was created from JavaScript
https://bugs.webkit.org/show_bug.cgi?id=200662
Summary Allow checking whether image was created from JavaScript
Rob Buis
Reported 2019-08-13 01:47:56 PDT
This is required by lazy image loading feature (bug 196698), since there is no way for the user to scroll down to the (not yet displayed) image and trigger the deferred load.
Attachments
Patch (4.84 KB, patch)
2019-08-13 01:50 PDT, Rob Buis
no flags
Patch (4.84 KB, patch)
2019-08-13 12:28 PDT, Rob Buis
no flags
Patch (4.83 KB, patch)
2019-09-04 06:07 PDT, Rob Buis
no flags
Rob Buis
Comment 1 2019-08-13 01:50:15 PDT
Rob Buis
Comment 2 2019-08-13 12:28:00 PDT
Rob Buis
Comment 3 2019-08-17 11:47:54 PDT
https://bugs.webkit.org/show_bug.cgi?id=200764 is also related, since it should build on this patch.
Darin Adler
Comment 4 2019-08-17 16:40:20 PDT
Comment on attachment 376195 [details] Patch Normally I suggest that people break down their changes into smaller patches, but in this case it seems strange to land the new HTMLImageElement::createdByParser function without the caller. The implementation looks OK, but I can’t tell the important questions like: If you create a document and parse an image and then change its attributes and move it into another document it seems you can "fake" created by parser. So is that a problem? Depends what we are using this for.
Rob Buis
Comment 5 2019-08-23 09:05:19 PDT
(In reply to Darin Adler from comment #4) > Comment on attachment 376195 [details] > Patch > > Normally I suggest that people break down their changes into smaller > patches, but in this case it seems strange to land the new > HTMLImageElement::createdByParser function without the caller. The > implementation looks OK, but I can’t tell the important questions like: If > you create a document and parse an image and then change its attributes and > move it into another document it seems you can "fake" created by parser. So > is that a problem? Depends what we are using this for. Sorry for the delay, I mailed some folks about this but got no feedback yet. The function is supposed to be used by the lazy image loading logic (https://bugs.webkit.org/show_bug.cgi?id=200764). Basically it gives an easy way to keep legacy eager loading behavior for Images added from JS. This is being discussed in https://github.com/whatwg/html/pull/3752. The latest suggestion is to use "connected" logic instead, however I think that only works when async loading/microtask is implemented, which is not yet the case in WebKit. Your move scenario is a good find. It does seem it is possible that way to fool the system with the patch as-is. A fix could be clearing the flag in didMoveToNewDocument. Since the main object was to keep legacy behavior working, this would not break that, and since it is quite some trouble to fool the system, and lazy image load is new and behind a runtime flag, I think landing this with a FIXME is okay. However, I can also wait a bit longer for feedback.
Rob Buis
Comment 6 2019-09-04 06:07:59 PDT
Rob Buis
Comment 7 2019-09-04 07:35:14 PDT
After more feedback, it is not entirely sure spec wise to go for the "connected" or "parser-created " concept. I think for now the patch is fine so I'll land. However we will likely need tests so I opened: https://bugs.webkit.org/show_bug.cgi?id=201460
WebKit Commit Bot
Comment 8 2019-09-04 08:19:17 PDT
Comment on attachment 377975 [details] Patch Clearing flags on attachment: 377975 Committed r249480: <https://trac.webkit.org/changeset/249480>
WebKit Commit Bot
Comment 9 2019-09-04 08:19:19 PDT
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 10 2019-09-04 08:20:19 PDT
Note You need to log in before you can comment on or make changes to this bug.