Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash at WebExtensionDynamicScripts::executeScript. #29982

Merged
merged 1 commit into from
Jun 20, 2024

Conversation

xeenon
Copy link
Contributor

@xeenon xeenon commented Jun 19, 2024

d794fd4

Crash at WebExtensionDynamicScripts::executeScript.
https://webkit.org/b/275668
rdar://130154054

Reviewed by Jeff Miller.

The crash was happening because an `optional` was being accessed while not being checked for a value.
We don't need to use `optional` here, so this change removes the optional uses and uses `WTF::compactMap`
for the one remaining `optional` return to filter the `SourcePair` results into a `SourcePairs` `Vector`.

* Source/WebKit/UIProcess/Extensions/Cocoa/API/WebExtensionContextAPITabsCocoa.mm:
(WebKit::WebExtensionContext::tabsExecuteScript):
* Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionDynamicScriptsCocoa.mm:
(WebKit::WebExtensionDynamicScripts::getSourcePairsForParameters):
(WebKit::WebExtensionDynamicScripts::executeScript):
(WebKit::WebExtensionDynamicScripts::injectStyleSheets):
(WebKit::WebExtensionDynamicScripts::removeStyleSheets):
* Source/WebKit/UIProcess/Extensions/WebExtensionDynamicScripts.h:

Canonical link: https://commits.webkit.org/280212@main

9a112d2

Misc iOS, visionOS, tvOS & watchOS macOS Linux Windows
βœ… πŸ§ͺ style βœ… πŸ›  ios βœ… πŸ›  mac βœ… πŸ›  wpe βœ… πŸ›  wincairo
βœ… πŸ›  ios-sim βœ… πŸ›  mac-AS-debug βœ… πŸ§ͺ wpe-wk2 βœ… πŸ§ͺ wincairo-tests
βœ… πŸ§ͺ webkitperl βœ… πŸ§ͺ ios-wk2 βœ… πŸ§ͺ api-mac βœ… πŸ§ͺ api-wpe
βœ… πŸ§ͺ ios-wk2-wpt βœ… πŸ›  wpe-cairo
βœ… πŸ§ͺ api-ios ❌ πŸ§ͺ mac-wk2 βœ… πŸ›  gtk
⏳ πŸ›  vision βœ… πŸ§ͺ mac-AS-debug-wk2 βœ… πŸ§ͺ gtk-wk2
⏳ πŸ›  vision-sim βœ… πŸ§ͺ mac-wk2-stress βœ… πŸ§ͺ api-gtk
⏳ πŸ§ͺ vision-wk2
βœ… πŸ›  πŸ§ͺ unsafe-merge βœ… πŸ›  tv
βœ… πŸ›  tv-sim
βœ… πŸ›  watch
βœ… πŸ›  watch-sim

@xeenon xeenon requested a review from b-weinstein as a code owner June 19, 2024 18:19
@xeenon xeenon self-assigned this Jun 19, 2024
@xeenon xeenon added the WebKit Extensions Bugs related to extension support. label Jun 19, 2024
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Jun 19, 2024
@xeenon xeenon removed the merging-blocked Applied to prevent a change from being merged label Jun 20, 2024
@xeenon xeenon requested a review from jeffmapple June 20, 2024 18:18
@xeenon xeenon added the unsafe-merge-queue Applied to send a pull request to merge-queue, but skip building and testing label Jun 20, 2024
https://webkit.org/b/275668
rdar://130154054

Reviewed by Jeff Miller.

The crash was happening because an `optional` was being accessed while not being checked for a value.
We don't need to use `optional` here, so this change removes the optional uses and uses `WTF::compactMap`
for the one remaining `optional` return to filter the `SourcePair` results into a `SourcePairs` `Vector`.

* Source/WebKit/UIProcess/Extensions/Cocoa/API/WebExtensionContextAPITabsCocoa.mm:
(WebKit::WebExtensionContext::tabsExecuteScript):
* Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionDynamicScriptsCocoa.mm:
(WebKit::WebExtensionDynamicScripts::getSourcePairsForParameters):
(WebKit::WebExtensionDynamicScripts::executeScript):
(WebKit::WebExtensionDynamicScripts::injectStyleSheets):
(WebKit::WebExtensionDynamicScripts::removeStyleSheets):
* Source/WebKit/UIProcess/Extensions/WebExtensionDynamicScripts.h:

Canonical link: https://commits.webkit.org/280212@main
@webkit-commit-queue
Copy link
Collaborator

Committed 280212@main (d794fd4): https://commits.webkit.org/280212@main

Reviewed commits have been landed. Closing PR #29982 and removing active labels.

@webkit-commit-queue webkit-commit-queue merged commit d794fd4 into WebKit:main Jun 20, 2024
@webkit-commit-queue webkit-commit-queue removed the unsafe-merge-queue Applied to send a pull request to merge-queue, but skip building and testing label Jun 20, 2024
@xeenon xeenon deleted the bug/275668 branch June 21, 2024 01:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
WebKit Extensions Bugs related to extension support.
Projects
None yet
6 participants