| Summary: | Optimize DOM storage event dispatch | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | Chris Dumez <cdumez> | ||||||||
| Component: | WebCore Misc. | Assignee: | Chris Dumez <cdumez> | ||||||||
| Status: | RESOLVED FIXED | ||||||||||
| Severity: | Normal | CC: | achristensen, ews-watchlist, ggaren, hi, japhet, joepeck, pangle, sam, sihui_liu, webkit-bug-importer, youennf | ||||||||
| Priority: | P2 | Keywords: | InRadar | ||||||||
| Version: | WebKit Nightly Build | ||||||||||
| Hardware: | Unspecified | ||||||||||
| OS: | Unspecified | ||||||||||
| Bug Depends on: | |||||||||||
| Bug Blocks: | 236985 | ||||||||||
| Attachments: |
|
||||||||||
|
Description
Chris Dumez
2022-02-18 16:13:43 PST
Created attachment 452601 [details]
Patch
Created attachment 452650 [details]
Patch
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. (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. Created attachment 452669 [details]
Patch
(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. (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. 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]. |