RESOLVED FIXED 209548
ScopeRuleSets::initializeUserStyle() should not add console logging if there are no injected user style sheets
https://bugs.webkit.org/show_bug.cgi?id=209548
Summary ScopeRuleSets::initializeUserStyle() should not add console logging if there ...
Kate Cheney
Reported 2020-03-25 10:22:03 PDT
Logging when there are no injected user style sheets is unnecessary and confusing.
Attachments
Patch (1.98 KB, patch)
2020-03-26 08:53 PDT, Kate Cheney
no flags
Patch for landing (1.98 KB, patch)
2020-03-26 11:29 PDT, Kate Cheney
no flags
Kate Cheney
Comment 1 2020-03-25 10:22:39 PDT
Kate Cheney
Comment 2 2020-03-26 08:53:35 PDT
Darin Adler
Comment 3 2020-03-26 10:23:46 PDT
Comment on attachment 394616 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=394616&action=review > Source/WebCore/ChangeLog:12 > + ScopeRuleSets::initializeUserStyle() should not add console logging if there are no injected user style sheets > + https://bugs.webkit.org/show_bug.cgi?id=209548 > + <rdar://problem/60851745> > + > + Reviewed by NOBODY (OOPS!). > + > + Logging when there are no injected user style sheets is unnecessary and confusing. > + > + * style/StyleScopeRuleSets.cpp: > + (WebCore::Style::ScopeRuleSets::initializeUserStyle): Strange indenting > Source/WebCore/style/StyleScopeRuleSets.cpp:96 > - if (page && page->mainFrame().loader().client().hasNavigatedAwayFromAppBoundDomain()) > + if (page && page->mainFrame().loader().client().hasNavigatedAwayFromAppBoundDomain() && !extensionStyleSheets.injectedUserStyleSheets().isEmpty()) > m_styleResolver.document().addConsoleMessage(MessageSource::Security, MessageLevel::Warning, "Ignoring user style sheet for non-app bound domain."_s); Besides not logging, this now means we’ll call collectRulesFromUserStyleSheets on the empty vector. No harm to that I suppose.
Kate Cheney
Comment 4 2020-03-26 11:29:08 PDT
Created attachment 394634 [details] Patch for landing
Kate Cheney
Comment 5 2020-03-26 11:32:04 PDT
(In reply to Darin Adler from comment #3) > Comment on attachment 394616 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=394616&action=review > Thanks Darin! > > Source/WebCore/ChangeLog:12 > > + ScopeRuleSets::initializeUserStyle() should not add console logging if there are no injected user style sheets > > + https://bugs.webkit.org/show_bug.cgi?id=209548 > > + <rdar://problem/60851745> > > + > > + Reviewed by NOBODY (OOPS!). > > + > > + Logging when there are no injected user style sheets is unnecessary and confusing. > > + > > + * style/StyleScopeRuleSets.cpp: > > + (WebCore::Style::ScopeRuleSets::initializeUserStyle): > > Strange indenting Good catch, fixed this in the patch for landing. > > > Source/WebCore/style/StyleScopeRuleSets.cpp:96 > > - if (page && page->mainFrame().loader().client().hasNavigatedAwayFromAppBoundDomain()) > > + if (page && page->mainFrame().loader().client().hasNavigatedAwayFromAppBoundDomain() && !extensionStyleSheets.injectedUserStyleSheets().isEmpty()) > > m_styleResolver.document().addConsoleMessage(MessageSource::Security, MessageLevel::Warning, "Ignoring user style sheet for non-app bound domain."_s); > > Besides not logging, this now means we’ll call > collectRulesFromUserStyleSheets on the empty vector. No harm to that I > suppose. I could follow up and add an if statement to check if extensionStyleSheets.injectedUserStyleSheets() is empty. I would probably also want to add one for extensionStyleSheets.documentUserStyleSheets() to be consistent.
Darin Adler
Comment 6 2020-03-26 11:32:45 PDT
(In reply to katherine_cheney from comment #5) > I could follow up and add an if statement to check if > extensionStyleSheets.injectedUserStyleSheets() is empty. I would probably > also want to add one for extensionStyleSheets.documentUserStyleSheets() to > be consistent. You should only do that if there’s a good reason. Otherwise I would suggest leaving things as-is.
EWS
Comment 7 2020-03-26 12:00:13 PDT
Committed r259062: <https://trac.webkit.org/changeset/259062> All reviewed patches have been landed. Closing bug and clearing flags on attachment 394634 [details].
Note You need to log in before you can comment on or make changes to this bug.