RESOLVED FIXED 212783
[Cocoa] CFPrefs synchronization does not always work for global preference changes
https://bugs.webkit.org/show_bug.cgi?id=212783
Summary [Cocoa] CFPrefs synchronization does not always work for global preference ch...
Per Arne Vollan
Reported 2020-06-04 14:44:22 PDT
In CFPrefs direct mode, synchronization of global preference changes from the UI process to the WebContent process does not always work. This is caused by the KVO notification being sent to the incorrect NSUserDefault object, which leads us to believe a non-global preference was changed. Since a global preference change always leads to some NSUserDefaults object receiving the notification, we can work around this by checking if the preference being changed really belongs to the domain of the NSUserDefaults object, or if it is a global preference.
Attachments
Patch (13.41 KB, patch)
2020-06-04 15:03 PDT, Per Arne Vollan
no flags
Patch (14.65 KB, patch)
2020-06-05 14:58 PDT, Per Arne Vollan
thorton: review+
Patch (13.53 KB, patch)
2020-06-08 09:10 PDT, Per Arne Vollan
no flags
Per Arne Vollan
Comment 1 2020-06-04 14:44:59 PDT
Per Arne Vollan
Comment 2 2020-06-04 15:03:25 PDT
Tim Horton
Comment 3 2020-06-04 15:07:48 PDT
Comment on attachment 401078 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=401078&action=review > Source/WebKit/ChangeLog:9 > + This is caused by the KVO notification being sent to the incorrect NSUserDefault object, which leads us to believe a non-global preference It's not incorrect! Global changes affect all domains. We're just inferring too much :D > Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm:923 > + if (domain.isEmpty()) I think you need to merge this with my change.
Per Arne Vollan
Comment 4 2020-06-04 15:18:00 PDT
(In reply to Tim Horton from comment #3) > Comment on attachment 401078 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=401078&action=review > > > Source/WebKit/ChangeLog:9 > > + This is caused by the KVO notification being sent to the incorrect NSUserDefault object, which leads us to believe a non-global preference > > It's not incorrect! Global changes affect all domains. We're just inferring > too much :D > Right :) > > Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm:923 > > + if (domain.isEmpty()) > > I think you need to merge this with my change. Ah, yes, this needs a rebase. Thanks for reviewing!
Per Arne Vollan
Comment 5 2020-06-05 14:58:30 PDT
Per Arne Vollan
Comment 6 2020-06-08 09:10:18 PDT
EWS
Comment 7 2020-06-08 10:40:30 PDT
Committed r262724: <https://trac.webkit.org/changeset/262724> All reviewed patches have been landed. Closing bug and clearing flags on attachment 401343 [details].
Tim Horton
Comment 8 2020-06-10 11:04:57 PDT
*** Bug 212627 has been marked as a duplicate of this bug. ***
Darin Adler
Comment 9 2020-06-10 11:26:21 PDT
Comment on attachment 401203 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=401203&action=review > Source/WebKit/UIProcess/Cocoa/PreferenceObserver.mm:72 > + if (!m_observer) > + return; Don’t we want "continue" here instead of return? If we want return, then why not do this outside the loop?
Per Arne Vollan
Comment 10 2020-06-10 14:21:49 PDT
(In reply to Darin Adler from comment #9) > Comment on attachment 401203 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=401203&action=review > > > Source/WebKit/UIProcess/Cocoa/PreferenceObserver.mm:72 > > + if (!m_observer) > > + return; > > Don’t we want "continue" here instead of return? If we want return, then why > not do this outside the loop? You're right! This check should be moved outside the loop.
Note You need to log in before you can comment on or make changes to this bug.