-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Don't fire window or tab events until the browser calls didOpenTab: and didOpenWindow:. #23841
Conversation
EWS run on previous version of this PR (hash 25d7f5b) |
Should this be |
ASSERT(m_windowMap.get(window.identifier()) == &window); | ||
ASSERT(isValidWindow(window)); | ||
|
||
// The window might already be open, don't log an error. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have any examples of when this could have been the case? It might be useful to list one here if we know what it is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We blindly call this in a couple places, to make sure it is open, like the delegate calls to populate on load, when the app might have already told us about the window directly too. These methods are also tied directly to the API, and I figured it was fine to no show too much noise if client app calls it multiple times since we ignore repeats.
ASSERT(m_tabMap.get(tab.identifier()) == &tab); | ||
ASSERT(isValidTab(tab)); | ||
|
||
// The tab might already be open, don't log an error. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto adding an example of when this could happen.
EWS run on current version of this PR (hash 8669f6f) |
β¦nd didOpenWindow:. https://webkit.org/b/268671 rdar://122143707 Reviewed by Brian Weinstein. Be more protective of when we fire window and tab events, so we never fire events if the window or tab hasn't fired the onCreated event. Also add more smart pointer use, assertions, and error logging to catch misuse. While fixing this, I discovered the WKWebExtensionAPITabs.QueryWithPrivateAccess test was not correct and was missing the tests for the incognito windows. Fixed things up there, and added optional chaining to avoid exceptions when things are incorrectly undefined / null. * Source/WebKit/UIProcess/API/Cocoa/_WKWebExtensionContext.mm: (toAPI): * Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionContextCocoa.mm: (WebKit::WebExtensionContext::postAsyncNotification): (WebKit::WebExtensionContext::removeGrantedPermissionMatchPatterns): (WebKit::WebExtensionContext::getOrCreateWindow const): (WebKit::WebExtensionContext::getWindow const): (WebKit::WebExtensionContext::forgetWindow const): (WebKit::WebExtensionContext::getOrCreateTab const): (WebKit::WebExtensionContext::getTab const): (WebKit::WebExtensionContext::getCurrentTab const): (WebKit::WebExtensionContext::forgetTab const): (WebKit::WebExtensionContext::populateWindowsAndTabs): (WebKit::WebExtensionContext::isValidWindow): (WebKit::WebExtensionContext::isValidTab): (WebKit::WebExtensionContext::openWindows const): (WebKit::WebExtensionContext::openTabs const): (WebKit::WebExtensionContext::frontmostWindow const): (WebKit::WebExtensionContext::didOpenWindow): (WebKit::WebExtensionContext::didCloseWindow): (WebKit::WebExtensionContext::didFocusWindow): (WebKit::WebExtensionContext::didOpenTab): (WebKit::WebExtensionContext::didCloseTab): (WebKit::WebExtensionContext::didActivateTab): (WebKit::WebExtensionContext::didSelectOrDeselectTabs): (WebKit::WebExtensionContext::didMoveTab): (WebKit::WebExtensionContext::didReplaceTab): (WebKit::WebExtensionContext::didChangeTabProperties): (WebKit::WebExtensionContext::resourceLoadDidSendRequest): (WebKit::WebExtensionContext::resourceLoadDidPerformHTTPRedirection): (WebKit::WebExtensionContext::resourceLoadDidReceiveChallenge): (WebKit::WebExtensionContext::resourceLoadDidReceiveResponse): (WebKit::WebExtensionContext::resourceLoadDidCompleteWithError): * Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionTabCocoa.mm: (WebKit::WebExtensionTab::parameters const): (WebKit::WebExtensionTab::index const): (WebKit::WebExtensionTab::parentTab const): (WebKit::WebExtensionTab::mainWebView const): (WebKit::WebExtensionTab::webViews const): (WebKit::WebExtensionTab::isOpen const): (WebKit::WebExtensionTab::isActive const): (WebKit::WebExtensionTab::isPrivate const): * Source/WebKit/UIProcess/Extensions/Cocoa/WebExtensionWindowCocoa.mm: (WebKit::WebExtensionWindow::activeTab const): (WebKit::WebExtensionWindow::isOpen const): * Source/WebKit/UIProcess/Extensions/WebExtensionContext.h: (WebKit::WebExtensionContext::openTabs const): Deleted. * Source/WebKit/UIProcess/Extensions/WebExtensionTab.h: (WebKit::WebExtensionTab::didOpen): (WebKit::WebExtensionTab::didClose): * Source/WebKit/UIProcess/Extensions/WebExtensionWindow.h: (WebKit::WebExtensionWindow::didOpen): (WebKit::WebExtensionWindow::didClose): * Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionAPITabs.mm: (TestWebKitAPI::TEST): Canonical link: https://commits.webkit.org/274103@main
8669f6f
to
1e7cb6d
Compare
Committed 274103@main (1e7cb6d): https://commits.webkit.org/274103@main Reviewed commits have been landed. Closing PR #23841 and removing active labels. |
1e7cb6d
8669f6f
π iosπ macπ wpeπ wincairoπ ios-simπ mac-AS-debugπ§ͺ wpe-wk2π§ͺ webkitperlπ§ͺ ios-wk2π§ͺ api-macπ§ͺ api-wpeπ§ͺ ios-wk2-wptπ§ͺ mac-wk1π gtkπ§ͺ api-iosπ§ͺ mac-wk2π§ͺ gtk-wk2π tvπ§ͺ mac-AS-debug-wk2π§ͺ api-gtkπ tv-simπ watchπ watch-sim