Closed Bug 1168208 Opened 10 years ago Closed 10 years ago

Refactor the existing logic for syncing the security info between Response and channel objects into a new helper class

Categories

(Core :: DOM: Service Workers, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla41
Tracking Status
firefox41 --- fixed

People

(Reporter: ehsan.akhgari, Assigned: ehsan.akhgari)

References

Details

Attachments

(1 file)

I will introduce a new ChannelInfo object in this bug that will have only one member for the security info for now. We may want to store other things in it later.
Assignee: nobody → ehsan
Asking review from Ben on the Cache parts, Josh on the intercepted channel parts, and Nikhil on everything else. Note that this patch should not change the existing behavior of anything, it is merely a refactoring of the security info nsCString members stored all over the place into ChannelInfo.
Attachment #8610243 - Flags: review?(nsm.nikhil)
Attachment #8610243 - Flags: review?(josh)
Attachment #8610243 - Flags: review?(bkelly)
Attachment #8610243 - Flags: review?(josh) → review+
Comment on attachment 8610243 [details] [diff] [review] Refactor the existing logic for syncing the security info between Response and channel objects into a new helper class Review of attachment 8610243 [details] [diff] [review]: ----------------------------------------------------------------- Would it be worth sticking something like this in DBSchema to make sure its updated when ChannelInfo changes? static_assert(sizeof(IPCChannelInfo) == sizeof(nsCString), "ChannelInfo should have one field"); ::: dom/fetch/ChannelInfo.h @@ +69,5 @@ > +private: > + void SetSecurityInfo(nsISupports* aSecurityInfo); > + > +private: > + nsCString mSecurityInfo; You could avoid duplicating the definition of the underlying data type by putting an IPCChannelInfo here instead of inlining fields like mSecurityInfo again. Writing a serializer for ChannelInfo is the other option to avoid code duplication.
Attachment #8610243 - Flags: review?(bkelly) → review+
Comment on attachment 8610243 [details] [diff] [review] Refactor the existing logic for syncing the security info between Response and channel objects into a new helper class Review of attachment 8610243 [details] [diff] [review]: ----------------------------------------------------------------- ::: dom/fetch/ChannelInfo.h @@ +19,5 @@ > +namespace dom { > + > +// This class represents the information related to a Response that we > +// retrieve from the corresponding channel that is used to perform the fetch. > +// Note: when adding new members to this object, the following code needs to Nit: Get rid of 'Note:' and move this to a separate paragraph instead. @@ +27,5 @@ > +// * ResurrectInfoOnChannel member > +// * AsIPCChannelInfo member > +// * constructors and assignment operators for this class. > +// * DOM Cache schema code (in dom/cache/DBSchema.cpp) to ensure that the newly > +// added member is saved into the DB and loaded from it properly. Please add a comment about how this should be used by both setters and getters considering we fail hard if !mInited. @@ +36,5 @@ > + > + ChannelInfo() > + : mInited(false) > + { > + } Nit: newline. ::: netwerk/protocol/http/nsHttpConnectionInfo.h @@ +10,5 @@ > #include "nsHttp.h" > #include "nsProxyInfo.h" > #include "nsCOMPtr.h" > #include "nsStringFwd.h" > +#include "mozilla/Logging.h" Different patch?
Attachment #8610243 - Flags: review?(nsm.nikhil) → review+
(In reply to Ben Kelly [:bkelly] from comment #3) > Comment on attachment 8610243 [details] [diff] [review] > Refactor the existing logic for syncing the security info between Response > and channel objects into a new helper class > > Review of attachment 8610243 [details] [diff] [review]: > ----------------------------------------------------------------- > > Would it be worth sticking something like this in DBSchema to make sure its > updated when ChannelInfo changes? > > static_assert(sizeof(IPCChannelInfo) == sizeof(nsCString), "ChannelInfo > should have one field"); Unfortunately mInited will make this fail.
(In reply to Ben Kelly [:bkelly] from comment #3) > Would it be worth sticking something like this in DBSchema to make sure its > updated when ChannelInfo changes? > > static_assert(sizeof(IPCChannelInfo) == sizeof(nsCString), "ChannelInfo > should have one field"); What Nikhil said. :/ > ::: dom/fetch/ChannelInfo.h > @@ +69,5 @@ > > +private: > > + void SetSecurityInfo(nsISupports* aSecurityInfo); > > + > > +private: > > + nsCString mSecurityInfo; > > You could avoid duplicating the definition of the underlying data type by > putting an IPCChannelInfo here instead of inlining fields like mSecurityInfo > again. > > Writing a serializer for ChannelInfo is the other option to avoid code > duplication. I would like to delay doing anything here until we know what else we would like to store here, and will then consider merging these types... (In reply to Nikhil Marathe [:nsm] (needinfo? please) from comment #4) > ::: netwerk/protocol/http/nsHttpConnectionInfo.h > @@ +10,5 @@ > > #include "nsHttp.h" > > #include "nsProxyInfo.h" > > #include "nsCOMPtr.h" > > #include "nsStringFwd.h" > > +#include "mozilla/Logging.h" > > Different patch? This is needed in order to be able to #include "HttpBaseChannel.h" standalone, which is needed in ChannelInfo.cpp.
Flags: needinfo?(ehsan)
Bug 1161684 broke this... Trying to fix right now.
Flags: needinfo?(ehsan)
Depends on: 1161684
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla41
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: