Bug 102593

Summary: Add an integer identifier field to AuthenticationChallengeBase
Product: WebKit Reporter: Brady Eidson <beidson>
Component: Page LoadingAssignee: Brady Eidson <beidson>
Status: RESOLVED FIXED    
Severity: Normal CC: abarth, andersca, ap, danw, fishd, gtk-ews, gustavo, mrobinson, rakuco, sam, webkit-ews, webkit.review.bot, xan.lopez
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Bug Depends on:    
Bug Blocks: 102592    
Attachments:
Description Flags
Patch v1
webkit-ews: commit-queue-
Patch v2 - Probably need one more round at EWS
buildbot: commit-queue-
Patch v3 - Hopefully last shot at EWS
buildbot: commit-queue-
Patch v4 - Come on Windows, you can do it. darin: review+

Description Brady Eidson 2012-11-17 11:42:09 PST
Add an integer identifier field to AuthenticationChallengeBase

This is to support linking two different challenges that might not compare as equal but that represent the same logical authentication challenge.
One example is in an IPC environment where the platform challenge can only exist in one process.
Comment 1 Brady Eidson 2012-11-17 11:51:21 PST
Created attachment 174824 [details]
Patch v1
Comment 2 WebKit Review Bot 2012-11-17 11:53:34 PST
Attachment 174824 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebCore/ChangeLog', u'Source/WebCor..." exit_code: 1
Source/WebCore/platform/network/cf/AuthenticationChallenge.h:52:  The parameter name "protectionSpace" adds no information, so it should be removed.  [readability/parameter_name] [5]
Source/WebCore/platform/network/cf/AuthenticationChallenge.h:52:  The parameter name "response" adds no information, so it should be removed.  [readability/parameter_name] [5]
Source/WebCore/platform/network/cf/AuthenticationChallenge.h:52:  The parameter name "error" adds no information, so it should be removed.  [readability/parameter_name] [5]
Total errors found: 3 in 8 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Early Warning System Bot 2012-11-17 12:00:05 PST
Comment on attachment 174824 [details]
Patch v1

Attachment 174824 [details] did not pass qt-wk2-ews (qt):
Output: http://queues.webkit.org/results/14877336
Comment 4 EFL EWS Bot 2012-11-17 12:20:04 PST
Comment on attachment 174824 [details]
Patch v1

Attachment 174824 [details] did not pass efl-ews (efl):
Output: http://queues.webkit.org/results/14859835
Comment 5 kov's GTK+ EWS bot 2012-11-17 12:34:50 PST
Comment on attachment 174824 [details]
Patch v1

Attachment 174824 [details] did not pass gtk-ews (gtk):
Output: http://queues.webkit.org/results/14875419
Comment 6 Brady Eidson 2012-11-17 12:44:34 PST
Created attachment 174827 [details]
Patch v2 - Probably need one more round at EWS
Comment 7 Brady Eidson 2012-11-17 12:45:05 PST
One more shot at EWS to make sure qt/soup/win don't need changes within WebCore.
Comment 8 WebKit Review Bot 2012-11-17 12:46:13 PST
Attachment 174827 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebCore/ChangeLog', u'Source/WebCor..." exit_code: 1
Source/WebCore/platform/network/qt/AuthenticationChallenge.h:43:  Tab found; better to use spaces  [whitespace/tab] [1]
Source/WebCore/platform/network/soup/AuthenticationChallenge.h:45:  Tab found; better to use spaces  [whitespace/tab] [1]
Source/WebCore/platform/network/win/AuthenticationChallenge.h:41:  Tab found; better to use spaces  [whitespace/tab] [1]
Total errors found: 3 in 11 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 9 Brady Eidson 2012-11-17 12:55:14 PST
Replaced tabs locally.  As long as the rest of EWS passes, I won't reupload for that.
Comment 10 Build Bot 2012-11-17 13:16:56 PST
Comment on attachment 174827 [details]
Patch v2 - Probably need one more round at EWS

Attachment 174827 [details] did not pass win-ews (win):
Output: http://queues.webkit.org/results/14876374
Comment 11 Brady Eidson 2012-11-17 14:36:53 PST
Created attachment 174829 [details]
Patch v3 - Hopefully last shot at EWS
Comment 12 WebKit Review Bot 2012-11-17 14:38:29 PST
Attachment 174829 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebCore/ChangeLog', u'Source/WebCor..." exit_code: 1
Source/WebCore/platform/network/cf/AuthenticationCF.cpp:56:  Weird number of spaces at line-start.  Are you using a 4-space indent?  [whitespace/indent] [3]
Source/WebCore/platform/network/cf/AuthenticationCF.cpp:57:  Weird number of spaces at line-start.  Are you using a 4-space indent?  [whitespace/indent] [3]
Source/WebCore/platform/network/cf/AuthenticationCF.cpp:64:  Tab found; better to use spaces  [whitespace/tab] [1]
Source/WebCore/platform/network/cf/AuthenticationCF.cpp:77:  Tab found; better to use spaces  [whitespace/tab] [1]
Total errors found: 4 in 12 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 13 Build Bot 2012-11-17 15:08:32 PST
Comment on attachment 174829 [details]
Patch v3 - Hopefully last shot at EWS

Attachment 174829 [details] did not pass win-ews (win):
Output: http://queues.webkit.org/results/14879295
Comment 14 Brady Eidson 2012-11-17 15:31:09 PST
Created attachment 174830 [details]
Patch v4 - Come on Windows, you can do it.
Comment 15 WebKit Review Bot 2012-11-17 15:33:04 PST
Attachment 174830 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebCore/ChangeLog', u'Source/WebCor..." exit_code: 1
Source/WebCore/platform/network/cf/AuthenticationCF.cpp:56:  Weird number of spaces at line-start.  Are you using a 4-space indent?  [whitespace/indent] [3]
Source/WebCore/platform/network/cf/AuthenticationCF.cpp:57:  Weird number of spaces at line-start.  Are you using a 4-space indent?  [whitespace/indent] [3]
Source/WebKit/win/WebURLAuthenticationChallenge.cpp:151:  When wrapping a line, only indent 4 spaces.  [whitespace/indent] [3]
Total errors found: 3 in 14 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 16 Brady Eidson 2012-11-17 15:55:16 PST
With EWS finally satisfied, marking r?
Comment 17 Darin Adler 2012-11-17 16:00:35 PST
Comment on attachment 174830 [details]
Patch v4 - Come on Windows, you can do it.

View in context: https://bugs.webkit.org/attachment.cgi?id=174830&action=review

> Source/WebCore/platform/network/AuthenticationChallengeBase.cpp:50
> +    , m_identifier(0)

Seems this constructor should take the identifier as an argument.

> Source/WebCore/platform/network/AuthenticationChallengeBase.cpp:87
> +    m_identifier = 0;

Why need this one field be zeroed out explicitly, but not others, such as m_error?
Comment 18 Brady Eidson 2012-11-17 16:43:45 PST
(In reply to comment #17)
> (From update of attachment 174830 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=174830&action=review
> 
> > Source/WebCore/platform/network/AuthenticationChallengeBase.cpp:50
> > +    , m_identifier(0)
> 
> Seems this constructor should take the identifier as an argument.

Eventually it might.

But for now the usefulness of the identifier is tied up directly with creation from a platform authentication challenge.  This will be clear in https://bugs.webkit.org/show_bug.cgi?id=102592

> 
> > Source/WebCore/platform/network/AuthenticationChallengeBase.cpp:87
> > +    m_identifier = 0;
> 
> Why need this one field be zeroed out explicitly, but not others, such as m_error?

I'll leave this m_identifier = 0; out of this patch and re-add it with the patch upcoming in https://bugs.webkit.org/show_bug.cgi?id=102592 along with a more thorough nulling-out.
Comment 19 Brady Eidson 2012-11-17 16:46:56 PST
http://trac.webkit.org/changeset/135055
Comment 20 Adam Barth 2012-11-18 09:00:33 PST
Comment on attachment 174830 [details]
Patch v4 - Come on Windows, you can do it.

View in context: https://bugs.webkit.org/attachment.cgi?id=174830&action=review

> Source/WebCore/platform/network/AuthenticationChallengeBase.cpp:35
> +    , m_identifier(0)

Historically, the Chromium port has made an effort to keep identifiers like this out of WebCore because they are usually a concern of multiprocess code an not a concern of WebCore.  Would it be possible to keep these WebKit2-only concerns in the WebKit2 layer so as not to add complexity to ports that don't care to use WebKit2?
Comment 21 Brady Eidson 2012-11-18 11:39:53 PST
(In reply to comment #20)
> (From update of attachment 174830 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=174830&action=review
> 
> > Source/WebCore/platform/network/AuthenticationChallengeBase.cpp:35
> > +    , m_identifier(0)
> 
> Historically, the Chromium port has made an effort to keep identifiers like this out of WebCore because they are usually a concern of multiprocess code an not a concern of WebCore.

We've done a lot of the same in WebKit2.

> Would it be possible to keep these WebKit2-only concerns in the WebKit2 layer so as not to add complexity to ports that don't care to use WebKit2?

Each situation should probably be viewed on its own merits.

In WebKit2's CoreIPC we commonly pass WebCore types over the wire, and there's been plenty of periodic work to make changes in WebCore to support this.

The WebCore/platform directly is both an interface layer to adapt platforms to WebCore and a support layer to provide those ports the support they need for their goals.  Especially since the frequency of AuthenticationChallenges is so low and there's basically no risk for performance or memory usage issues, it seemed reasonable to advance in this manner.

Especially compared to some of the much larger and more turbulent refactorings in the past that were solely to support one port's IPC architecture, I'm not sure what the big deal is about this one.

If you feel strongly about it I can revisit and put the identifier member in each of the relevant ports AuthenticationChallenge.h/cpps.  But I'm not sure how that is better.
Comment 22 Adam Barth 2012-11-18 12:32:34 PST
> I'm not sure what the big deal is about this one.

Oh, I don't think it's such a big deal.  It's just a design pattern that we consciously try to avoid, and I wanted to make sure we were all on the same page.  It sounds like you agree with the principle in general.
Comment 23 Brady Eidson 2012-11-18 12:41:18 PST
(In reply to comment #22)
> > I'm not sure what the big deal is about this one.
> 
> Oh, I don't think it's such a big deal.  It's just a design pattern that we consciously try to avoid, and I wanted to make sure we were all on the same page.  It sounds like you agree with the principle in general.

I think we agree in general.
Comment 24 Alexey Proskuryakov 2013-01-17 00:19:42 PST
> Historically, the Chromium port has made an effort to keep identifiers like this out of WebCore because they are usually a concern of multiprocess code an not a concern of WebCore.  Would it be possible to keep these WebKit2-only concerns in the WebKit2 layer so as not to add complexity to ports that don't care to use WebKit2?

Yes, I agree. In fact, WebKit2 already uses a better technique when exchanging AuthenticationChallenges between WebProcess and UI Process. A transient ID is generated just for IPC, and is not part of AuthenticationChallenge.

I'll work on a patch that removes the identifier from AuthenticationChallenge. This patch will also make NetworkProcess IPC more efficient, as we won't be sending an unchanged AuthenticationChallenge in responses.