RESOLVED FIXED 215566
Add setting for lazy iframe loading
https://bugs.webkit.org/show_bug.cgi?id=215566
Summary Add setting for lazy iframe loading
Rob Buis
Reported 2020-08-17 07:03:52 PDT
Add runtime flag for lazy iframe loading
Attachments
Patch (5.13 KB, patch)
2020-08-17 07:52 PDT, Rob Buis
no flags
Patch (11.03 KB, patch)
2020-08-17 12:33 PDT, Rob Buis
no flags
Patch (9.53 KB, patch)
2020-08-17 12:34 PDT, Rob Buis
no flags
Patch (9.26 KB, patch)
2020-08-19 05:24 PDT, Rob Buis
no flags
Patch (2.83 KB, patch)
2020-08-25 05:45 PDT, Rob Buis
no flags
Patch (2.83 KB, patch)
2020-08-25 08:45 PDT, Rob Buis
no flags
Rob Buis
Comment 1 2020-08-17 07:52:12 PDT
Sam Weinig
Comment 2 2020-08-17 10:36:23 PDT
Comment on attachment 406716 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=406716&action=review > Source/WebKit/Shared/WebPreferences.yaml:2038 > + webcoreBinding: RuntimeEnabledFeatures What's the reason behind using RuntimeEnabledFeatures rather than the default, Settings? In general, I think we should always prefer Settings over RuntimeEnabledFeatures as they are not global singletons and are automatically accessible in layout tests via InternalSettingsGenerated.
Rob Buis
Comment 3 2020-08-17 11:01:01 PDT
Comment on attachment 406716 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=406716&action=review >> Source/WebKit/Shared/WebPreferences.yaml:2038 >> + webcoreBinding: RuntimeEnabledFeatures > > What's the reason behind using RuntimeEnabledFeatures rather than the default, Settings? In general, I think we should always prefer Settings over RuntimeEnabledFeatures as they are not global singletons and are automatically accessible in layout tests via InternalSettingsGenerated. This will be used though to enable the loading attribute in HTMLIFrameElement.idl, AFAIK there is not a way to make that work using Settings.
Sam Weinig
Comment 4 2020-08-17 11:16:15 PDT
(In reply to Rob Buis from comment #3) > Comment on attachment 406716 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=406716&action=review > > >> Source/WebKit/Shared/WebPreferences.yaml:2038 > >> + webcoreBinding: RuntimeEnabledFeatures > > > > What's the reason behind using RuntimeEnabledFeatures rather than the default, Settings? In general, I think we should always prefer Settings over RuntimeEnabledFeatures as they are not global singletons and are automatically accessible in layout tests via InternalSettingsGenerated. > > This will be used though to enable the loading attribute in > HTMLIFrameElement.idl, AFAIK there is not a way to make that work using > Settings. I believe `[EnabledBySetting=Foo] attribute DOMString loading;` would work for this.
Rob Buis
Comment 5 2020-08-17 11:24:08 PDT
Comment on attachment 406716 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=406716&action=review >>>> Source/WebKit/Shared/WebPreferences.yaml:2038 >>>> + webcoreBinding: RuntimeEnabledFeatures >>> >>> What's the reason behind using RuntimeEnabledFeatures rather than the default, Settings? In general, I think we should always prefer Settings over RuntimeEnabledFeatures as they are not global singletons and are automatically accessible in layout tests via InternalSettingsGenerated. >> >> This will be used though to enable the loading attribute in HTMLIFrameElement.idl, AFAIK there is not a way to make that work using Settings. > > I believe `[EnabledBySetting=Foo] attribute DOMString loading;` would work for this. Thanks, I was not aware of that. Does this mean LazyImageLoading runtime flag will need the same treatment?
Sam Weinig
Comment 6 2020-08-17 12:20:15 PDT
(In reply to Rob Buis from comment #5) > Comment on attachment 406716 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=406716&action=review > > >>>> Source/WebKit/Shared/WebPreferences.yaml:2038 > >>>> + webcoreBinding: RuntimeEnabledFeatures > >>> > >>> What's the reason behind using RuntimeEnabledFeatures rather than the default, Settings? In general, I think we should always prefer Settings over RuntimeEnabledFeatures as they are not global singletons and are automatically accessible in layout tests via InternalSettingsGenerated. > >> > >> This will be used though to enable the loading attribute in HTMLIFrameElement.idl, AFAIK there is not a way to make that work using Settings. > > > > I believe `[EnabledBySetting=Foo] attribute DOMString loading;` would work for this. > > Thanks, I was not aware of that. Does this mean LazyImageLoading runtime > flag will need the same treatment? Ideally, yes.
Rob Buis
Comment 7 2020-08-17 12:33:07 PDT
EWS Watchlist
Comment 8 2020-08-17 12:33:52 PDT
This patch modifies the imported WPT tests. Please ensure that any changes on the tests (not coming from a WPT import) are exported to WPT. Please see https://trac.webkit.org/wiki/WPTExportProcess
Rob Buis
Comment 9 2020-08-17 12:34:49 PDT
Rob Buis
Comment 10 2020-08-17 22:49:00 PDT
Comment on attachment 406716 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=406716&action=review >>>>>> Source/WebKit/Shared/WebPreferences.yaml:2038 >>>>>> + webcoreBinding: RuntimeEnabledFeatures >>>>> >>>>> What's the reason behind using RuntimeEnabledFeatures rather than the default, Settings? In general, I think we should always prefer Settings over RuntimeEnabledFeatures as they are not global singletons and are automatically accessible in layout tests via InternalSettingsGenerated. >>>> >>>> This will be used though to enable the loading attribute in HTMLIFrameElement.idl, AFAIK there is not a way to make that work using Settings. >>> >>> I believe `[EnabledBySetting=Foo] attribute DOMString loading;` would work for this. >> >> Thanks, I was not aware of that. Does this mean LazyImageLoading runtime flag will need the same treatment? > > Ideally, yes. Thanks, will try to make a patch for that after this one.
youenn fablet
Comment 11 2020-08-19 02:10:21 PDT
Comment on attachment 406732 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=406732&action=review > LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-iframe-element/iframe-loading-lazy-base-url-2.tentative.html:14 > + internals.settings.setLazyIframeLoadingEnabled(true); It would not be great to upstream these changes to WPT. Either you could update testharnessreport.js to enable the setting or you could use <!-- webkit-test-runner -->
Rob Buis
Comment 12 2020-08-19 05:24:26 PDT
Rob Buis
Comment 13 2020-08-19 05:27:55 PDT
Comment on attachment 406732 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=406732&action=review >> LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-iframe-element/iframe-loading-lazy-base-url-2.tentative.html:14 >> + internals.settings.setLazyIframeLoadingEnabled(true); > > It would not be great to upstream these changes to WPT. > Either you could update testharnessreport.js to enable the setting or you could use <!-- webkit-test-runner --> Thanks, I attempted the testharnessreport.js approach, let me know if you had that in mind. If yes I suppose I should put it up on wpt first? I don't think settings are set using <!-- webkit-test-runner --> before, so I think that one would need a lot of plumbing....
Radar WebKit Bug Importer
Comment 14 2020-08-24 07:04:18 PDT
youenn fablet
Comment 15 2020-08-24 08:35:38 PDT
Comment on attachment 406842 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=406842&action=review > LayoutTests/imported/w3c/web-platform-tests/resources/testharness.js:3674 > + expose(enable_internal_setting, 'enable_internal_setting'); We do not want to touch testharness.js, this change should go in testharnessreport.js. And we do not want to change the html/semantics/embedded-content/the-iframe-element/iframe-loading-xx files as well. Something like the following in testharnessreport.js: if (location.port == 8800 || location.port == 9443) internals.settings.setLazyIframeLoadingEnabled(true) If you want to only enable lazy loading for these tests, you will need to write something like the following in testharnessreport.js: if (location.port == 8800 || location.port == 9443) internals.settings.setLazyIframeLoadingEnabled(location.pathname.indexOf('iframe-loading-lazy') !== -1) You can look at what we are doing for AudioContext there as an example.
Rob Buis
Comment 16 2020-08-25 05:45:19 PDT
Rob Buis
Comment 17 2020-08-25 06:45:49 PDT
Comment on attachment 406842 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=406842&action=review >> LayoutTests/imported/w3c/web-platform-tests/resources/testharness.js:3674 >> + expose(enable_internal_setting, 'enable_internal_setting'); > > We do not want to touch testharness.js, this change should go in testharnessreport.js. > And we do not want to change the html/semantics/embedded-content/the-iframe-element/iframe-loading-xx files as well. > > Something like the following in testharnessreport.js: > if (location.port == 8800 || location.port == 9443) > internals.settings.setLazyIframeLoadingEnabled(true) > > If you want to only enable lazy loading for these tests, you will need to write something like the following in testharnessreport.js: > if (location.port == 8800 || location.port == 9443) > internals.settings.setLazyIframeLoadingEnabled(location.pathname.indexOf('iframe-loading-lazy') !== -1) > > You can look at what we are doing for AudioContext there as an example. Thanks for the hints! I put up a new patch. I am not sure for the AudioContext example, maybe the patch is still under development?
youenn fablet
Comment 18 2020-08-25 08:28:46 PDT
Comment on attachment 407184 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=407184&action=review > LayoutTests/imported/w3c/web-platform-tests/resources/testharnessreport.js:58 > + } This should go in LayoutTests/resources/testharnessreport.js which should override this file. There is already a section with if (location.port == 8800 || location.port == 9443)
Rob Buis
Comment 19 2020-08-25 08:45:14 PDT
EWS
Comment 20 2020-08-25 09:44:30 PDT
Committed r266127: <https://trac.webkit.org/changeset/266127> All reviewed patches have been landed. Closing bug and clearing flags on attachment 407194 [details].
Note You need to log in before you can comment on or make changes to this bug.