| Summary: | Add checks for app-bound navigations when evaluating user style sheets | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | Kate Cheney <katherine_cheney> | ||||||||||
| Component: | WebKit Misc. | Assignee: | Kate Cheney <katherine_cheney> | ||||||||||
| Status: | RESOLVED FIXED | ||||||||||||
| Severity: | Normal | CC: | aestes, bfulgham, cdumez, ews-watchlist, japhet, koivisto, thorton, wilander | ||||||||||
| Priority: | P2 | Keywords: | InRadar | ||||||||||
| Version: | WebKit Nightly Build | ||||||||||||
| Hardware: | Unspecified | ||||||||||||
| OS: | Unspecified | ||||||||||||
| Attachments: |
|
||||||||||||
|
Description
Kate Cheney
2020-03-20 16:54:18 PDT
Created attachment 394150 [details]
Patch
Created attachment 394263 [details]
Patch
Created attachment 394266 [details]
Patch
Comment on attachment 394266 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=394266&action=review Awesome! Thank you for creating useful tests for this. r=me, but please add the logging I suggest. > Source/WebCore/page/Page.cpp:3078 > + if (m_mainFrame->loader().client().hasNavigatedAwayFromAppBoundDomain()) I feel like we should issue some kind of console message so developers will know what's going on. Look for instances of 'document->addConsoleMessage' (or context->addConsoleMessage) for examples. > Source/WebCore/style/StyleScopeRuleSets.cpp:98 > + collectRulesFromUserStyleSheets(extensionStyleSheets.injectedUserStyleSheets(), tempUserStyle.get(), mediaQueryEvaluator); I suggest: auto* page = m_styleResolver.document().page(); if (page && page->mainFrame().loader().client().hasNavigatedAwayFromAppBoundDomain()) m_styleResolver.document().addConsoleMessage(MessageSource::Security, MessageLevel::Warning, "Ignoring user style sheet for non-app bound domain."_s); else collectRulesFromUserStyleSheets(extensionStyleSheets.injectedUserStyleSheets(), tempUserStyle.get(), mediaQueryEvaluator); > Tools/TestWebKitAPI/Tests/WebKitCocoa/InAppBrowserPrivacy.mm:76 > + response = @"<body style='background-color: red;'><iframe src='in-app-browser:///in-app-browser-privacy-test-user-style-sheets'></iframe></body>"; Nice! Created attachment 394279 [details]
Patch for landing
(In reply to Brent Fulgham from comment #5) > Comment on attachment 394266 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=394266&action=review > > Awesome! Thank you for creating useful tests for this. r=me, but please add > the logging I suggest. Thanks! I added the logging you suggested. Committed r258863: <https://trac.webkit.org/changeset/258863> All reviewed patches have been landed. Closing bug and clearing flags on attachment 394279 [details]. |