RESOLVED FIXED 236871
Optimize DOM storage event dispatch
https://bugs.webkit.org/show_bug.cgi?id=236871
Summary Optimize DOM storage event dispatch
Chris Dumez
Reported 2022-02-18 16:13:43 PST
Optimize DOM storage event dispatch.
Attachments
Patch (36.86 KB, patch)
2022-02-18 16:18 PST, Chris Dumez
no flags
Patch (36.82 KB, patch)
2022-02-19 12:34 PST, Chris Dumez
no flags
Patch (36.57 KB, patch)
2022-02-19 20:42 PST, Chris Dumez
no flags
Chris Dumez
Comment 1 2022-02-18 16:18:03 PST
Chris Dumez
Comment 2 2022-02-19 12:34:56 PST
Sihui Liu
Comment 3 2022-02-19 20:19:41 PST
Comment on attachment 452650 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=452650&action=review r=me > Source/WebCore/storage/StorageEventDispatcher.cpp:55 > + if (!frame->document() || !frame->window()) > continue; > - if (sourceFrame != frame && frame->document()->securityOrigin().equal(securityOrigin.securityOrigin().ptr())) > - frames.append(frame); > + if (!frame->window()->hasEventListeners(eventNames().storageEvent)) window() also checks document(). maybe something like: if (auto* window = frame->window(); !window || !window->hasEventListeners(eventNames().storageEvent)) continue; > Source/WebCore/storage/StorageEventDispatcher.cpp:77 > + if (!frame->document() || !frame->window()) > + continue; > + if (!frame->window()->hasEventListeners(eventNames().storageEvent)) Ditto.
Chris Dumez
Comment 4 2022-02-19 20:35:55 PST
(In reply to Sihui Liu from comment #3) > Comment on attachment 452650 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=452650&action=review > > r=me No r+? :) > > Source/WebCore/storage/StorageEventDispatcher.cpp:55 > > + if (!frame->document() || !frame->window()) > > continue; > > - if (sourceFrame != frame && frame->document()->securityOrigin().equal(securityOrigin.securityOrigin().ptr())) > > - frames.append(frame); > > + if (!frame->window()->hasEventListeners(eventNames().storageEvent)) > > window() also checks document(). maybe something like: > if (auto* window = frame->window(); !window || > !window->hasEventListeners(eventNames().storageEvent)) continue; > > > Source/WebCore/storage/StorageEventDispatcher.cpp:77 > > + if (!frame->document() || !frame->window()) > > + continue; > > + if (!frame->window()->hasEventListeners(eventNames().storageEvent)) > > Ditto.
Chris Dumez
Comment 5 2022-02-19 20:42:01 PST
Chris Dumez
Comment 6 2022-02-19 20:42:42 PST
(In reply to Chris Dumez from comment #4) > (In reply to Sihui Liu from comment #3) > > Comment on attachment 452650 [details] > > Patch > > > > View in context: > > https://bugs.webkit.org/attachment.cgi?id=452650&action=review > > > > r=me > > No r+? :) > > > > Source/WebCore/storage/StorageEventDispatcher.cpp:55 > > > + if (!frame->document() || !frame->window()) > > > continue; > > > - if (sourceFrame != frame && frame->document()->securityOrigin().equal(securityOrigin.securityOrigin().ptr())) > > > - frames.append(frame); > > > + if (!frame->window()->hasEventListeners(eventNames().storageEvent)) > > > > window() also checks document(). maybe something like: > > if (auto* window = frame->window(); !window || > > !window->hasEventListeners(eventNames().storageEvent)) continue; > > > > > Source/WebCore/storage/StorageEventDispatcher.cpp:77 > > > + if (!frame->document() || !frame->window()) > > > + continue; > > > + if (!frame->window()->hasEventListeners(eventNames().storageEvent)) > > > > Ditto. Thanks for reviewing, I made the suggested changes.
Sihui Liu
Comment 7 2022-02-19 20:51:38 PST
(In reply to Chris Dumez from comment #6) > (In reply to Chris Dumez from comment #4) > > (In reply to Sihui Liu from comment #3) > > > Comment on attachment 452650 [details] > > > Patch > > > > > > View in context: > > > https://bugs.webkit.org/attachment.cgi?id=452650&action=review > > > > > > r=me > > > > No r+? :) r+ > > > > > > Source/WebCore/storage/StorageEventDispatcher.cpp:55 > > > > + if (!frame->document() || !frame->window()) > > > > continue; > > > > - if (sourceFrame != frame && frame->document()->securityOrigin().equal(securityOrigin.securityOrigin().ptr())) > > > > - frames.append(frame); > > > > + if (!frame->window()->hasEventListeners(eventNames().storageEvent)) > > > > > > window() also checks document(). maybe something like: > > > if (auto* window = frame->window(); !window || > > > !window->hasEventListeners(eventNames().storageEvent)) continue; > > > > > > > Source/WebCore/storage/StorageEventDispatcher.cpp:77 > > > > + if (!frame->document() || !frame->window()) > > > > + continue; > > > > + if (!frame->window()->hasEventListeners(eventNames().storageEvent)) > > > > > > Ditto. > > Thanks for reviewing, I made the suggested changes.
EWS
Comment 8 2022-02-19 23:13:40 PST
Committed r290223 (247549@main): <https://commits.webkit.org/247549@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 452669 [details].
Radar WebKit Bug Importer
Comment 9 2022-02-19 23:14:17 PST
Note You need to log in before you can comment on or make changes to this bug.