RESOLVED FIXED 171367
Refactor SessionID to support multiple non-ephemeral (persistent) sessions
https://bugs.webkit.org/show_bug.cgi?id=171367
Summary Refactor SessionID to support multiple non-ephemeral (persistent) sessions
Brady Eidson
Reported 2017-04-26 23:22:12 PDT
Refactor SessionID to support multiple persistent sessions
Attachments
Patch (18.40 KB, patch)
2017-04-27 00:02 PDT, Brady Eidson
achristensen: review-
beidson: commit-queue-
Patch (20.34 KB, patch)
2017-04-27 10:25 PDT, Brady Eidson
aestes: review+
aestes: commit-queue-
Patch for landing (20.33 KB, patch)
2017-04-27 11:15 PDT, Brady Eidson
no flags
Patch for landing (20.32 KB, patch)
2017-04-27 11:25 PDT, Brady Eidson
buildbot: commit-queue-
Archive of layout-test-results from ews100 for mac-elcapitan (1.39 MB, application/zip)
2017-04-27 12:34 PDT, Build Bot
no flags
Archive of layout-test-results from ews115 for mac-elcapitan (1.42 MB, application/zip)
2017-04-27 12:38 PDT, Build Bot
no flags
Archive of layout-test-results from ews107 for mac-elcapitan-wk2 (1.75 MB, application/zip)
2017-04-27 12:45 PDT, Build Bot
no flags
Patch for EWS (20.35 KB, patch)
2017-04-27 13:09 PDT, Brady Eidson
no flags
Patch for landing (20.52 KB, patch)
2017-04-27 14:18 PDT, Brady Eidson
no flags
Brady Eidson
Comment 1 2017-04-27 00:02:20 PDT
Brady Eidson
Comment 2 2017-04-27 00:23:31 PDT
gtk == Forgot to add the new cpp file to cmake, of course. Still reviewable, would fix before landing.
Alex Christensen
Comment 3 2017-04-27 00:40:24 PDT
Comment on attachment 308352 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=308352&action=review > Source/WebCore/page/SessionID.cpp:37 > +static uint64_t currentPersistentID = 1; I don't think this will work. Other processes will also need to be able to tell whether this session is ephemeral or not, and their static variables won't be synchronized. We should probably make a SessionID a wrapper around a bool and a uint64_t.
Brady Eidson
Comment 4 2017-04-27 08:58:03 PDT
(In reply to Alex Christensen from comment #3) > Comment on attachment 308352 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=308352&action=review > > > Source/WebCore/page/SessionID.cpp:37 > > +static uint64_t currentPersistentID = 1; > > I don't think this will work. Other processes will also need to be able to > tell whether this session is ephemeral or not, and their static variables > won't be synchronized. We should probably make a SessionID a wrapper around > a bool and a uint64_t. Yup, of course it won't, duh.
Brady Eidson
Comment 5 2017-04-27 09:35:16 PDT
(In reply to Alex Christensen from comment #3) > We should probably make a SessionID a wrapper around a bool and a uint64_t. Going to leave it a uint64_t, reserving the high bit for the bool.
Brady Eidson
Comment 6 2017-04-27 10:25:18 PDT
Andy Estes
Comment 7 2017-04-27 10:30:51 PDT
Comment on attachment 308406 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=308406&action=review > Source/WebCore/page/SessionID.cpp:35 > +static bool generationProtectionEnabled = false; No need for the = false. > Source/WebCore/page/SessionID.h:90 > + return sessionID.isValid(); Is an invalid sessionID really an decoding failure? Does something stop us from encoding invalid values?
Alex Christensen
Comment 8 2017-04-27 10:37:48 PDT
Comment on attachment 308406 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=308406&action=review > Source/WebCore/page/SessionID.cpp:34 > +static uint64_t currentEphemeralID = SessionID::LegacyPrivateSessionID; Couldn't we just start at std::numeric_limits<uint64_t>::max() and count backwards? > Source/WebCore/page/SessionID.h:40 > + enum { Don't we like enum classes these days? Also, does this need to be public?
Brady Eidson
Comment 9 2017-04-27 10:50:11 PDT
(In reply to Alex Christensen from comment #8) > Comment on attachment 308406 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=308406&action=review > > > Source/WebCore/page/SessionID.cpp:34 > > +static uint64_t currentEphemeralID = SessionID::LegacyPrivateSessionID; > > Couldn't we just start at std::numeric_limits<uint64_t>::max() and count > backwards? Could we? Yes. But that would be a magic constant with no explanation. Makes sense to me to have the persistent and ephemeral IDs work the same way - Start at the shared default for each and then count up. > > > Source/WebCore/page/SessionID.h:40 > > + enum { > > Don't we like enum classes these days? Also, does this need to be public? We do like enum classes with standalone types but are not adverse to enums inside of classes. Also, the purposes of these enums are not for type safety, but rather to capture some magic constants. If it were an enum class there'd be a lot of unnecessary casting-to-uint64_t literally everywhere they were used.
Brady Eidson
Comment 10 2017-04-27 10:51:04 PDT
(In reply to Alex Christensen from comment #8) > Comment on attachment 308406 [details] > > > Source/WebCore/page/SessionID.h:40 > > + enum { > Also, does this need to be public? It does not need to be, but it does need to be declared before the 4 static c'tors that use them. I'll add a second private section for the enums.
Brady Eidson
Comment 11 2017-04-27 10:53:05 PDT
(In reply to Andy Estes from comment #7) > Comment on attachment 308406 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=308406&action=review > > > Source/WebCore/page/SessionID.cpp:35 > > +static bool generationProtectionEnabled = false; > > No need for the = false. Indeed. > > > Source/WebCore/page/SessionID.h:90 > > + return sessionID.isValid(); > > Is an invalid sessionID really an decoding failure? Does something stop us > from encoding invalid values? I think so. The invalid ones should only be used for Hashing, and even if you were to encode a HashSet/HashMap with these in it you'd never actually encode/decode invalid sessionIDs.
Brady Eidson
Comment 12 2017-04-27 11:15:18 PDT
Created attachment 308411 [details] Patch for landing Will CQ+ after EWS and local API tests run.
Brady Eidson
Comment 13 2017-04-27 11:24:25 PDT
(In reply to Brady Eidson from comment #10) > (In reply to Alex Christensen from comment #8) > > Comment on attachment 308406 [details] > > > > > Source/WebCore/page/SessionID.h:40 > > > + enum { > > Also, does this need to be public? > > It does not need to be, but it does need to be declared before the 4 static > c'tors that use them. > > I'll add a second private section for the enums. Actually yes, they need to be public.
Brady Eidson
Comment 14 2017-04-27 11:25:30 PDT
Created attachment 308414 [details] Patch for landing
Build Bot
Comment 15 2017-04-27 12:34:43 PDT
Comment on attachment 308414 [details] Patch for landing Attachment 308414 [details] did not pass mac-ews (mac): Output: http://webkit-queues.webkit.org/results/3621386 Number of test failures exceeded the failure limit.
Build Bot
Comment 16 2017-04-27 12:34:44 PDT
Created attachment 308429 [details] Archive of layout-test-results from ews100 for mac-elcapitan The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: ews100 Port: mac-elcapitan Platform: Mac OS X 10.11.6
Brady Eidson
Comment 17 2017-04-27 12:36:09 PDT
That "&" should be a "|" :) (Rebuilding the world now...)
Build Bot
Comment 18 2017-04-27 12:38:47 PDT
Comment on attachment 308414 [details] Patch for landing Attachment 308414 [details] did not pass mac-debug-ews (mac): Output: http://webkit-queues.webkit.org/results/3621314 Number of test failures exceeded the failure limit.
Build Bot
Comment 19 2017-04-27 12:38:48 PDT
Created attachment 308430 [details] Archive of layout-test-results from ews115 for mac-elcapitan The attached test failures were seen while running run-webkit-tests on the mac-debug-ews. Bot: ews115 Port: mac-elcapitan Platform: Mac OS X 10.11.6
Build Bot
Comment 20 2017-04-27 12:45:32 PDT
Comment on attachment 308414 [details] Patch for landing Attachment 308414 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.webkit.org/results/3621439 Number of test failures exceeded the failure limit.
Build Bot
Comment 21 2017-04-27 12:45:34 PDT
Created attachment 308431 [details] Archive of layout-test-results from ews107 for mac-elcapitan-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews107 Port: mac-elcapitan-wk2 Platform: Mac OS X 10.11.6
Brady Eidson
Comment 22 2017-04-27 13:09:22 PDT
Created attachment 308435 [details] Patch for EWS
Brady Eidson
Comment 23 2017-04-27 14:07:13 PDT
(In reply to Andy Estes from comment #7) > > > Source/WebCore/page/SessionID.h:90 > > + return sessionID.isValid(); > > Is an invalid sessionID really an decoding failure? Does something stop us > from encoding invalid values? Unfortunately (or perhaps fortunately) this came up in a single API test. I'm replacing the ASSERTs with FIXMEs for now, as I still think it's the right way to go.
Brady Eidson
Comment 24 2017-04-27 14:18:10 PDT
Created attachment 308445 [details] Patch for landing
WebKit Commit Bot
Comment 25 2017-04-27 16:48:54 PDT
Comment on attachment 308445 [details] Patch for landing Clearing flags on attachment: 308445 Committed r215907: <http://trac.webkit.org/changeset/215907>
WebKit Commit Bot
Comment 26 2017-04-27 16:48:56 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.