Bug 776176 - e10s: propagate GetExtendedOrigin from child to parent process. r=jdm
authorJason Duell <jduell.mcbugs@gmail.com>
Mon, 23 Jul 2012 11:12:03 -0700
changeset 105646 b672c3b20e58f8ee71376f46094ebfba1943bfad
parent 105645 e7f9ffc61ef7d7bcd13dbd7458f38b08c6373850
child 105647 b65ced8fa66b0edae6b3f18b5b7a07340e57b734
push id1490
push userakeybl@mozilla.com
push dateMon, 08 Oct 2012 18:29:50 +0000
treeherdermozilla-beta@f335e7dacdc1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdm
bugs776176
milestone17.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 776176 - e10s: propagate GetExtendedOrigin from child to parent process. r=jdm
netwerk/base/public/nsNetUtil.h
netwerk/base/src/nsBaseChannel.h
netwerk/protocol/ftp/FTPChannelChild.cpp
netwerk/protocol/ftp/FTPChannelParent.cpp
netwerk/protocol/ftp/FTPChannelParent.h
netwerk/protocol/ftp/PFTPChannel.ipdl
netwerk/protocol/http/HttpChannelChild.cpp
netwerk/protocol/http/HttpChannelParent.cpp
netwerk/protocol/http/HttpChannelParent.h
netwerk/protocol/http/PHttpChannel.ipdl
netwerk/protocol/websocket/PWebSocket.ipdl
netwerk/protocol/websocket/WebSocketChannelChild.cpp
netwerk/protocol/websocket/WebSocketChannelParent.cpp
netwerk/protocol/websocket/WebSocketChannelParent.h
netwerk/protocol/wyciwyg/PWyciwygChannel.ipdl
netwerk/protocol/wyciwyg/WyciwygChannelChild.cpp
netwerk/protocol/wyciwyg/WyciwygChannelParent.cpp
netwerk/protocol/wyciwyg/WyciwygChannelParent.h
--- a/netwerk/base/public/nsNetUtil.h
+++ b/netwerk/base/public/nsNetUtil.h
@@ -1294,27 +1294,67 @@ NS_QueryNotificationCallbacks(nsIInterfa
             if (cbs)
                 cbs->GetInterface(iid, result);
         }
     }
 }
 
 /**
  * Returns true if channel is using Private Browsing, or false if not.
- *
- * Note: you may get a false negative if you call this before AsyncOpen has been
- * called (technically, before the channel's notificationCallbacks are set: this
- * is almost always done before AsyncOpen).
+ * Returns false if channel's callbacks don't implement nsILoadContext.
  */
 inline bool
 NS_UsePrivateBrowsing(nsIChannel *channel)
 {
-  nsCOMPtr<nsILoadContext> loadContext;
-  NS_QueryNotificationCallbacks(channel, loadContext);
-  return loadContext && loadContext->UsePrivateBrowsing();
+    nsCOMPtr<nsILoadContext> loadContext;
+    NS_QueryNotificationCallbacks(channel, loadContext);
+    return loadContext && loadContext->UsePrivateBrowsing();
+}
+
+/**
+ * Gets ExtendedOrigin value for given channel's nsILoadContext.
+ * Returns false if error or channel's callbacks don't implement nsILoadContext.
+ */
+inline bool
+NS_GetExtendedOrigin(nsIChannel *aChannel, nsACString &aResult)
+{
+    nsCOMPtr<nsILoadContext> loadContext;
+    NS_QueryNotificationCallbacks(aChannel, loadContext);
+    if (!loadContext) {
+        return false;
+    }
+    nsCOMPtr<nsIURI> uri;
+    nsresult rv = aChannel->GetURI(getter_AddRefs(uri));
+    NS_ENSURE_SUCCESS(rv, false);
+
+    rv = loadContext->GetExtendedOrigin(uri, aResult);
+    NS_ENSURE_SUCCESS(rv, false);
+    return true;
+}
+
+/**
+ * Gets AppId and isInBrowserElement from channel's nsILoadContext.
+ * Returns false if error or channel's callbacks don't implement nsILoadContext.
+ */
+inline bool
+NS_GetAppInfo(nsIChannel *aChannel, PRUint32 *aAppID, bool *aIsInBrowserElement)
+{
+    nsCOMPtr<nsILoadContext> loadContext;
+    NS_QueryNotificationCallbacks(aChannel, loadContext);
+    if (!loadContext) {
+        return false;
+    }
+
+    nsresult rv = loadContext->GetAppId(aAppID);
+    NS_ENSURE_SUCCESS(rv, false);
+
+    rv = loadContext->GetIsInBrowserElement(aIsInBrowserElement);
+    NS_ENSURE_SUCCESS(rv, false);
+
+    return true;
 }
 
 /**
  * Wraps an nsIAuthPrompt so that it can be used as an nsIAuthPrompt2. This
  * method is provided mainly for use by other methods in this file.
  *
  * *aAuthPrompt2 should be set to null before calling this function.
  */
--- a/netwerk/base/src/nsBaseChannel.h
+++ b/netwerk/base/src/nsBaseChannel.h
@@ -242,31 +242,31 @@ private:
     nsRefPtr<nsBaseChannel> mChannel;
     nsCOMPtr<nsIChannel> mNewChannel;
   };
   friend class RedirectRunnable;
 
   nsRefPtr<nsInputStreamPump>         mPump;
   nsCOMPtr<nsIProgressEventSink>      mProgressSink;
   nsCOMPtr<nsIURI>                    mOriginalURI;
-  nsCOMPtr<nsIURI>                    mURI;
   nsCOMPtr<nsISupports>               mOwner;
   nsCOMPtr<nsISupports>               mSecurityInfo;
   nsCOMPtr<nsIChannel>                mRedirectChannel;
   nsCString                           mContentType;
   nsCString                           mContentCharset;
   PRUint32                            mLoadFlags;
   bool                                mQueriedProgressSink;
   bool                                mSynthProgressEvents;
   bool                                mWasOpened;
   bool                                mWaitingOnAsyncRedirect;
   bool                                mOpenRedirectChannel;
   PRUint32                            mRedirectFlags;
 
 protected:
+  nsCOMPtr<nsIURI>                    mURI;
   nsCOMPtr<nsILoadGroup>              mLoadGroup;
   nsCOMPtr<nsIInterfaceRequestor>     mCallbacks;
   nsCOMPtr<nsIStreamListener>         mListener;
   nsCOMPtr<nsISupports>               mListenerContext;
   nsresult                            mStatus;
 };
 
 #endif // !nsBaseChannel_h__
--- a/netwerk/protocol/ftp/FTPChannelChild.cpp
+++ b/netwerk/protocol/ftp/FTPChannelChild.cpp
@@ -161,31 +161,33 @@ FTPChannelChild::AsyncOpen(::nsIStreamLi
     mLoadGroup->AddRequest(this, nsnull);
 
   // Get info from nsILoadContext, if any
   bool haveLoadContext = false;
   bool isContent = false;
   bool usePrivateBrowsing = false;
   bool isInBrowserElement = false;
   PRUint32 appId = 0;
+  nsCAutoString extendedOrigin;
   nsCOMPtr<nsILoadContext> loadContext;
   NS_QueryNotificationCallbacks(mCallbacks, mLoadGroup,
                                 NS_GET_IID(nsILoadContext),
                                 getter_AddRefs(loadContext));
   if (loadContext) {
     haveLoadContext = true;
     loadContext->GetIsContent(&isContent);
     loadContext->GetUsePrivateBrowsing(&usePrivateBrowsing);
     loadContext->GetIsInBrowserElement(&isInBrowserElement);
     loadContext->GetAppId(&appId);
+    loadContext->GetExtendedOrigin(mURI, extendedOrigin);
   }
 
   SendAsyncOpen(nsBaseChannel::URI(), mStartPos, mEntityID,
                 IPC::InputStream(mUploadStream), haveLoadContext, isContent,
-                usePrivateBrowsing, isInBrowserElement, appId);
+                usePrivateBrowsing, isInBrowserElement, appId, extendedOrigin);
 
   // The socket transport layer in the chrome process now has a logical ref to
   // us until OnStopRequest is called.
   AddIPDLReference();
 
   mIsPending = true;
   mWasOpened = true;
 
--- a/netwerk/protocol/ftp/FTPChannelParent.cpp
+++ b/netwerk/protocol/ftp/FTPChannelParent.cpp
@@ -63,17 +63,18 @@ bool
 FTPChannelParent::RecvAsyncOpen(const IPC::URI& aURI,
                                 const PRUint64& aStartPos,
                                 const nsCString& aEntityID,
                                 const IPC::InputStream& aUploadStream,
                                 const bool& haveLoadContext,
                                 const bool& isContent,
                                 const bool& usePrivateBrowsing,
                                 const bool& isInBrowserElement,
-                                const PRUint32& appId)
+                                const PRUint32& appId,
+                                const nsCString& extendedOrigin)
 {
   nsCOMPtr<nsIURI> uri(aURI);
 
 #ifdef DEBUG
   nsCString uriSpec;
   uri->GetSpec(uriSpec);
   LOG(("FTPChannelParent RecvAsyncOpen [this=%x uri=%s]\n",
        this, uriSpec.get()));
@@ -104,16 +105,17 @@ FTPChannelParent::RecvAsyncOpen(const IP
     return SendFailedAsyncOpen(rv);
 
   // fields needed to impersonate nsILoadContext
   mHaveLoadContext = haveLoadContext;
   mIsContent = isContent;
   mUsePrivateBrowsing = usePrivateBrowsing;
   mIsInBrowserElement = isInBrowserElement;
   mAppId = appId;
+  mExtendedOrigin = extendedOrigin;
   mChannel->SetNotificationCallbacks(this);
 
   rv = mChannel->AsyncOpen(this, nsnull);
   if (NS_FAILED(rv))
     return SendFailedAsyncOpen(rv);
   
   return true;
 }
@@ -316,11 +318,19 @@ NS_IMETHODIMP
 FTPChannelParent::GetAppId(PRUint32* aAppId)
 {
   NS_ENSURE_ARG_POINTER(aAppId);
 
   *aAppId = mAppId;
   return NS_OK;
 }
 
+NS_IMETHODIMP
+FTPChannelParent::GetExtendedOrigin(nsIURI *aUri, nsACString &aResult)
+{
+  aResult = mExtendedOrigin;
+  return NS_OK;
+}
+
+
 } // namespace net
 } // namespace mozilla
 
--- a/netwerk/protocol/ftp/FTPChannelParent.h
+++ b/netwerk/protocol/ftp/FTPChannelParent.h
@@ -39,17 +39,18 @@ protected:
   NS_OVERRIDE virtual bool RecvAsyncOpen(const IPC::URI& uri,
                                          const PRUint64& startPos,
                                          const nsCString& entityID,
                                          const IPC::InputStream& uploadStream,
                                          const bool& haveLoadContext,
                                          const bool& isContent,
                                          const bool& usingPrivateBrowsing,
                                          const bool& isInBrowserElement,
-                                         const PRUint32& appId);
+                                         const PRUint32& appId,
+                                         const nsCString& extendedOrigin);
   NS_OVERRIDE virtual bool RecvConnectChannel(const PRUint32& channelId);
   NS_OVERRIDE virtual bool RecvCancel(const nsresult& status);
   NS_OVERRIDE virtual bool RecvSuspend();
   NS_OVERRIDE virtual bool RecvResume();
 
   NS_OVERRIDE virtual void ActorDestroy(ActorDestroyReason why);
 
   nsRefPtr<nsFtpChannel> mChannel;
@@ -58,14 +59,15 @@ protected:
 
   // fields for impersonating nsILoadContext
   bool mHaveLoadContext       : 1;
   bool mIsContent             : 1;
   bool mUsePrivateBrowsing    : 1;
   bool mIsInBrowserElement    : 1;
 
   PRUint32 mAppId;
+  nsCString mExtendedOrigin;
 };
 
 } // namespace net
 } // namespace mozilla
 
 #endif // mozilla_net_FTPChannelParent_h
--- a/netwerk/protocol/ftp/PFTPChannel.ipdl
+++ b/netwerk/protocol/ftp/PFTPChannel.ipdl
@@ -26,17 +26,18 @@ parent:
   AsyncOpen(URI uri,
             PRUint64 startPos,
             nsCString entityID,
             InputStream uploadStream,
             bool haveLoadContext,
             bool isContent,
             bool usePrivateBrowsing,
             bool isInBrowserElement,
-            PRUint32 appID);
+            PRUint32 appID,
+            nsCString extendedOrigin);
   ConnectChannel(PRUint32 channelId);
   Cancel(nsresult status);
   Suspend();
   Resume();
 
 child:
   OnStartRequest(PRInt32 aContentLength, nsCString aContentType,
                  PRTime aLastModified, nsCString aEntityID, URI aURI);
--- a/netwerk/protocol/http/HttpChannelChild.cpp
+++ b/netwerk/protocol/http/HttpChannelChild.cpp
@@ -1016,24 +1016,26 @@ HttpChannelChild::AsyncOpen(nsIStreamLis
   }
 
   // Get info from nsILoadContext, if any
   bool haveLoadContext = false;
   bool isContent = false;
   bool usePrivateBrowsing = false;
   bool isInBrowserElement = false;
   PRUint32 appId = 0;
+  nsCAutoString extendedOrigin;
   nsCOMPtr<nsILoadContext> loadContext;
   GetCallback(loadContext);
   if (loadContext) {
     haveLoadContext = true;
     loadContext->GetIsContent(&isContent);
     loadContext->GetUsePrivateBrowsing(&usePrivateBrowsing);
     loadContext->GetIsInBrowserElement(&isInBrowserElement);
     loadContext->GetAppId(&appId);
+    loadContext->GetExtendedOrigin(mURI, extendedOrigin);
   }
 
   //
   // Send request to the chrome process...
   //
 
   // FIXME: bug 558623: Combine constructor and SendAsyncOpen into one IPC msg
 
@@ -1053,17 +1055,17 @@ HttpChannelChild::AsyncOpen(nsIStreamLis
   SendAsyncOpen(IPC::URI(mURI), IPC::URI(mOriginalURI),
                 IPC::URI(mDocumentURI), IPC::URI(mReferrer), mLoadFlags,
                 mClientSetRequestHeaders, mRequestHead.Method(),
                 IPC::InputStream(mUploadStream), mUploadStreamHasHeaders,
                 mPriority, mRedirectionLimit, mAllowPipelining,
                 mForceAllowThirdPartyCookie, mSendResumeAt,
                 mStartPos, mEntityID, mChooseApplicationCache,
                 appCacheClientId, mAllowSpdy, haveLoadContext, isContent,
-                usePrivateBrowsing, isInBrowserElement, appId);
+                usePrivateBrowsing, isInBrowserElement, appId, extendedOrigin);
 
   return NS_OK;
 }
 
 //-----------------------------------------------------------------------------
 // HttpChannelChild::nsIHttpChannel
 //-----------------------------------------------------------------------------
 
--- a/netwerk/protocol/http/HttpChannelParent.cpp
+++ b/netwerk/protocol/http/HttpChannelParent.cpp
@@ -122,17 +122,18 @@ HttpChannelParent::RecvAsyncOpen(const I
                                  const nsCString&           entityID,
                                  const bool&                chooseApplicationCache,
                                  const nsCString&           appCacheClientID,
                                  const bool&                allowSpdy,
                                  const bool&                haveLoadContext,
                                  const bool&                isContent,
                                  const bool&                usePrivateBrowsing,
                                  const bool&                isInBrowserElement,
-                                 const PRUint32&            appId)
+                                 const PRUint32&            appId,
+                                 const nsCString&           extendedOrigin)
 {
   nsCOMPtr<nsIURI> uri(aURI);
   nsCOMPtr<nsIURI> originalUri(aOriginalURI);
   nsCOMPtr<nsIURI> docUri(aDocURI);
   nsCOMPtr<nsIURI> referrerUri(aReferrerURI);
 
   nsCString uriSpec;
   uri->GetSpec(uriSpec);
@@ -150,16 +151,17 @@ HttpChannelParent::RecvAsyncOpen(const I
     return SendFailedAsyncOpen(rv);
 
   // fields needed to impersonate nsILoadContext
   mHaveLoadContext = haveLoadContext;
   mIsContent = isContent;
   mUsePrivateBrowsing = usePrivateBrowsing;
   mIsInBrowserElement = isInBrowserElement;
   mAppId = appId;
+  mExtendedOrigin = extendedOrigin;
 
   nsHttpChannel *httpChan = static_cast<nsHttpChannel *>(mChannel.get());
 
   if (doResumeAt)
     httpChan->ResumeAt(startPos, entityID);
 
   if (originalUri)
     httpChan->SetOriginalURI(originalUri);
@@ -669,9 +671,16 @@ NS_IMETHODIMP
 HttpChannelParent::GetAppId(PRUint32* aAppId)
 {
   NS_ENSURE_ARG_POINTER(aAppId);
 
   *aAppId = mAppId;
   return NS_OK;
 }
 
+NS_IMETHODIMP
+HttpChannelParent::GetExtendedOrigin(nsIURI *aUri, nsACString &aResult)
+{
+  aResult = mExtendedOrigin;
+  return NS_OK;
+}
+
 }} // mozilla::net
--- a/netwerk/protocol/http/HttpChannelParent.h
+++ b/netwerk/protocol/http/HttpChannelParent.h
@@ -65,17 +65,18 @@ protected:
                              const nsCString&           entityID,
                              const bool&                chooseApplicationCache,
                              const nsCString&           appCacheClientID,
                              const bool&                allowSpdy,
                              const bool &               haveLoadContext,
                              const bool &               isContent,
                              const bool&                usingPrivateBrowsing,
                              const bool&                isInBrowserElement,
-                             const PRUint32&            appId);
+                             const PRUint32&            appId,
+                             const nsCString&           extendedOrigin);
 
   virtual bool RecvConnectChannel(const PRUint32& channelId);
   virtual bool RecvSetPriority(const PRUint16& priority);
   virtual bool RecvSetCacheTokenCachedCharset(const nsCString& charset);
   virtual bool RecvSuspend();
   virtual bool RecvResume();
   virtual bool RecvCancel(const nsresult& status);
   virtual bool RecvRedirect2Verify(const nsresult& result,
@@ -116,14 +117,15 @@ private:
 
   // fields for impersonating nsILoadContext
   bool mHaveLoadContext             : 1;
   bool mIsContent                   : 1;
   bool mUsePrivateBrowsing          : 1;
   bool mIsInBrowserElement          : 1;
 
   PRUint32 mAppId;
+  nsCString mExtendedOrigin;
 };
 
 } // namespace net
 } // namespace mozilla
 
 #endif // mozilla_net_HttpChannelParent_h
--- a/netwerk/protocol/http/PHttpChannel.ipdl
+++ b/netwerk/protocol/http/PHttpChannel.ipdl
@@ -45,23 +45,23 @@ parent:
             bool                allowPipelining,
             bool                forceAllowThirdPartyCookie,
             bool                resumeAt,
             PRUint64            startPos,
             nsCString           entityID,
             bool                chooseApplicationCache,
             nsCString           appCacheClientID,
             bool                allowSpdy,
-            // If child channel callbacks implement nsILoadContext, we implement
-            // it in HttpChannelParent too
+            // Fields for imitating a nsILoadContext
             bool                haveLoadContext,
             bool                isContent,
             bool                usePrivateBrowsing,
             bool                isInBrowserElement,
-            PRUint32            appID);
+            PRUint32            appID,
+            nsCString           extendedOrigin);
 
   // Used to connect redirected-to channel on the parent with redirected-to
   // channel on the child.
   ConnectChannel(PRUint32 channelId);
 
   SetPriority(PRUint16 priority);
 
   SetCacheTokenCachedCharset(nsCString charset);
--- a/netwerk/protocol/websocket/PWebSocket.ipdl
+++ b/netwerk/protocol/websocket/PWebSocket.ipdl
@@ -21,21 +21,23 @@ async protocol PWebSocket
   manager PNecko;
 
 parent:
   // Forwarded methods corresponding to methods on nsIWebSocketChannel
   AsyncOpen(URI aURI,
             nsCString aOrigin,
             nsCString aProtocol,
             bool aSecure,
+            // Fields for imitating a nsILoadContext
             bool haveLoadContext,
             bool isContent,
             bool usePrivateBrowsing,
             bool isInBrowserElement,
-            PRUint32 appID);
+            PRUint32 appID,
+            nsCString extendedOrigin);
   Close(PRUint16 code, nsCString reason);
   SendMsg(nsCString aMsg);
   SendBinaryMsg(nsCString aMsg);
   SendBinaryStream(InputStream aStream, PRUint32 aLength);
 
   DeleteSelf();
 
 child:
--- a/netwerk/protocol/websocket/WebSocketChannelChild.cpp
+++ b/netwerk/protocol/websocket/WebSocketChannelChild.cpp
@@ -329,35 +329,37 @@ WebSocketChannelChild::AsyncOpen(nsIURI 
   }
 
   // Get info from nsILoadContext, if any
   bool haveLoadContext = false;
   bool isContent = false;
   bool usePrivateBrowsing = false;
   bool isInBrowserElement = false;
   PRUint32 appId = 0;
+  nsCAutoString extendedOrigin;
   nsCOMPtr<nsILoadContext> loadContext;
   NS_QueryNotificationCallbacks(mCallbacks, mLoadGroup,
                                 NS_GET_IID(nsILoadContext),
                                 getter_AddRefs(loadContext));
   if (loadContext) {
     haveLoadContext = true;
     loadContext->GetIsContent(&isContent);
     loadContext->GetUsePrivateBrowsing(&usePrivateBrowsing);
     loadContext->GetIsInBrowserElement(&isInBrowserElement);
     loadContext->GetAppId(&appId);
+    loadContext->GetExtendedOrigin(mURI, extendedOrigin);
   }
 
   // Corresponding release in DeallocPWebSocket
   AddIPDLReference();
 
   gNeckoChild->SendPWebSocketConstructor(this, tabChild);
   if (!SendAsyncOpen(aURI, nsCString(aOrigin), mProtocol, mEncrypted,
                      haveLoadContext, isContent, usePrivateBrowsing,
-                     isInBrowserElement, appId))
+                     isInBrowserElement, appId, extendedOrigin))
     return NS_ERROR_UNEXPECTED;
 
   mOriginalURI = aURI;
   mURI = mOriginalURI;
   mListener = aListener;
   mContext = aContext;
   mOrigin = aOrigin;
 
--- a/netwerk/protocol/websocket/WebSocketChannelParent.cpp
+++ b/netwerk/protocol/websocket/WebSocketChannelParent.cpp
@@ -48,17 +48,18 @@ bool
 WebSocketChannelParent::RecvAsyncOpen(const IPC::URI& aURI,
                                       const nsCString& aOrigin,
                                       const nsCString& aProtocol,
                                       const bool& aSecure,
                                       const bool& haveLoadContext,
                                       const bool& isContent,
                                       const bool& usePrivateBrowsing,
                                       const bool& isInBrowserElement,
-                                      const PRUint32& appId)
+                                      const PRUint32& appId,
+                                      const nsCString& extendedOrigin)
 {
   LOG(("WebSocketChannelParent::RecvAsyncOpen() %p\n", this));
   nsresult rv;
   if (aSecure) {
     mChannel =
       do_CreateInstance("@mozilla.org/network/protocol;1?name=wss", &rv);
   } else {
     mChannel =
@@ -68,16 +69,17 @@ WebSocketChannelParent::RecvAsyncOpen(co
     goto fail;
 
   // fields needed to impersonate nsILoadContext
   mHaveLoadContext = haveLoadContext;
   mIsContent = isContent;
   mUsePrivateBrowsing = usePrivateBrowsing;
   mIsInBrowserElement = isInBrowserElement;
   mAppId = appId;
+  mExtendedOrigin = extendedOrigin;
   rv = mChannel->SetNotificationCallbacks(this);
   if (NS_FAILED(rv))
     goto fail;
 
   rv = mChannel->SetProtocol(aProtocol);
   if (NS_FAILED(rv))
     goto fail;
 
@@ -297,11 +299,19 @@ NS_IMETHODIMP
 WebSocketChannelParent::GetAppId(PRUint32* aAppId)
 {
   NS_ENSURE_ARG_POINTER(aAppId);
 
   *aAppId = mAppId;
   return NS_OK;
 }
 
+NS_IMETHODIMP
+WebSocketChannelParent::GetExtendedOrigin(nsIURI *aUri,
+                                          nsACString &aResult)
+{
+  aResult = mExtendedOrigin;
+  return NS_OK;
+}
+
 
 } // namespace net
 } // namespace mozilla
--- a/netwerk/protocol/websocket/WebSocketChannelParent.h
+++ b/netwerk/protocol/websocket/WebSocketChannelParent.h
@@ -36,17 +36,18 @@ class WebSocketChannelParent : public PW
   bool RecvAsyncOpen(const IPC::URI& aURI,
                      const nsCString& aOrigin,
                      const nsCString& aProtocol,
                      const bool& aSecure,
                      const bool& haveLoadContext,
                      const bool& isContent,
                      const bool& usingPrivateBrowsing,
                      const bool& isInBrowserElement,
-                     const PRUint32& appId);
+                     const PRUint32& appId,
+                     const nsCString& extendedOrigin);
   bool RecvClose(const PRUint16 & code, const nsCString & reason);
   bool RecvSendMsg(const nsCString& aMsg);
   bool RecvSendBinaryMsg(const nsCString& aMsg);
   bool RecvSendBinaryStream(const InputStream& aStream,
                             const PRUint32& aLength);
   bool RecvDeleteSelf();
 
   void ActorDestroy(ActorDestroyReason why);
@@ -57,14 +58,15 @@ class WebSocketChannelParent : public PW
 
   // fields for impersonating nsILoadContext
   bool mHaveLoadContext             : 1;
   bool mIsContent                   : 1;
   bool mUsePrivateBrowsing          : 1;
   bool mIsInBrowserElement          : 1;
 
   PRUint32 mAppId;
+  nsCString mExtendedOrigin;
 };
 
 } // namespace net
 } // namespace mozilla
 
 #endif // mozilla_net_WebSocketChannelParent_h
--- a/netwerk/protocol/wyciwyg/PWyciwygChannel.ipdl
+++ b/netwerk/protocol/wyciwyg/PWyciwygChannel.ipdl
@@ -17,21 +17,23 @@ protocol PWyciwygChannel
   manager PNecko;
 
 parent:
   __delete__();
 
   Init(URI uri);
   AsyncOpen(URI      originalURI,
             PRUint32 loadFlags,
+            // Fields for imitating a nsILoadContext
             bool     haveLoadContext,
             bool     isContent,
             bool     usePrivateBrowsing,
             bool     isInBrowserElement,
-            PRUint32 appID);
+            PRUint32 appID,
+            nsCString extendedOrigin);
 
   // methods corresponding to those of nsIWyciwygChannel
   WriteToCacheEntry(nsString data);
   CloseCacheEntry(nsresult reason);
   SetCharsetAndSource(PRInt32 source, nsCString charset);
   SetSecurityInfo(nsCString securityInfo);
   Cancel(nsresult status);
 
--- a/netwerk/protocol/wyciwyg/WyciwygChannelChild.cpp
+++ b/netwerk/protocol/wyciwyg/WyciwygChannelChild.cpp
@@ -563,30 +563,32 @@ WyciwygChannelChild::AsyncOpen(nsIStream
     mLoadGroup->AddRequest(this, nsnull);
 
   // Get info from nsILoadContext, if any
   bool haveLoadContext = false;
   bool isContent = false;
   bool usePrivateBrowsing = false;
   bool isInBrowserElement = false;
   PRUint32 appId = 0;
+  nsCAutoString extendedOrigin;
   nsCOMPtr<nsILoadContext> loadContext;
   NS_QueryNotificationCallbacks(mCallbacks, mLoadGroup,
                                 NS_GET_IID(nsILoadContext),
                                 getter_AddRefs(loadContext));
   if (loadContext) {
     haveLoadContext = true;
     loadContext->GetIsContent(&isContent);
     loadContext->GetUsePrivateBrowsing(&usePrivateBrowsing);
     loadContext->GetIsInBrowserElement(&isInBrowserElement);
     loadContext->GetAppId(&appId);
+    loadContext->GetExtendedOrigin(mURI, extendedOrigin);
   }
 
   SendAsyncOpen(IPC::URI(mOriginalURI), mLoadFlags, haveLoadContext, isContent,
-                usePrivateBrowsing, isInBrowserElement, appId);
+                usePrivateBrowsing, isInBrowserElement, appId, extendedOrigin);
 
   mState = WCC_OPENED;
 
   return NS_OK;
 }
 
 
 //-----------------------------------------------------------------------------
--- a/netwerk/protocol/wyciwyg/WyciwygChannelParent.cpp
+++ b/netwerk/protocol/wyciwyg/WyciwygChannelParent.cpp
@@ -85,17 +85,18 @@ WyciwygChannelParent::RecvInit(const IPC
 
 bool
 WyciwygChannelParent::RecvAsyncOpen(const IPC::URI& aOriginal,
                                     const PRUint32& aLoadFlags,
                                     const bool& haveLoadContext,
                                     const bool& isContent,
                                     const bool& usePrivateBrowsing,
                                     const bool& isInBrowserElement,
-                                    const PRUint32& appId)
+                                    const PRUint32& appId,
+                                    const nsCString& extendedOrigin)
 {
   nsCOMPtr<nsIURI> original(aOriginal);
 
   LOG(("WyciwygChannelParent RecvAsyncOpen [this=%x]\n", this));
 
   if (!mChannel)
     return true;
 
@@ -110,16 +111,17 @@ WyciwygChannelParent::RecvAsyncOpen(cons
     return SendCancelEarly(rv);
 
   // fields needed to impersonate nsILoadContext
   mHaveLoadContext = haveLoadContext;
   mIsContent = isContent;
   mUsePrivateBrowsing = usePrivateBrowsing;
   mIsInBrowserElement = isInBrowserElement;
   mAppId = appId;
+  mExtendedOrigin = extendedOrigin;
   mChannel->SetNotificationCallbacks(this);
 
   rv = mChannel->AsyncOpen(this, nsnull);
   if (NS_FAILED(rv))
     return SendCancelEarly(rv);
 
   return true;
 }
@@ -335,9 +337,18 @@ NS_IMETHODIMP
 WyciwygChannelParent::GetAppId(PRUint32* aAppId)
 {
   NS_ENSURE_ARG_POINTER(aAppId);
 
   *aAppId = mAppId;
   return NS_OK;
 }
 
+NS_IMETHODIMP
+WyciwygChannelParent::GetExtendedOrigin(nsIURI *aUri,
+                                        nsACString &aResult)
+{
+  aResult = mExtendedOrigin;
+  return NS_OK;
+}
+
+
 }} // mozilla::net
--- a/netwerk/protocol/wyciwyg/WyciwygChannelParent.h
+++ b/netwerk/protocol/wyciwyg/WyciwygChannelParent.h
@@ -34,17 +34,18 @@ public:
 protected:
   virtual bool RecvInit(const IPC::URI& uri);
   virtual bool RecvAsyncOpen(const IPC::URI& original,
                              const PRUint32& loadFlags,
                              const bool& haveLoadContext,
                              const bool& isContent,
                              const bool& usingPrivateBrowsing,
                              const bool& isInBrowserElement,
-                             const PRUint32& appId);
+                             const PRUint32& appId,
+                             const nsCString& extendedOrigin);
   virtual bool RecvWriteToCacheEntry(const nsString& data);
   virtual bool RecvCloseCacheEntry(const nsresult& reason);
   virtual bool RecvSetCharsetAndSource(const PRInt32& source,
                                        const nsCString& charset);
   virtual bool RecvSetSecurityInfo(const nsCString& securityInfo);
   virtual bool RecvCancel(const nsresult& statusCode);
 
   virtual void ActorDestroy(ActorDestroyReason why);
@@ -54,14 +55,15 @@ protected:
 
   // fields for impersonating nsILoadContext
   bool mHaveLoadContext             : 1;
   bool mIsContent                   : 1;
   bool mUsePrivateBrowsing          : 1;
   bool mIsInBrowserElement          : 1;
 
   PRUint32 mAppId;
+  nsCString mExtendedOrigin;
 };
 
 } // namespace net
 } // namespace mozilla
 
 #endif // mozilla_net_WyciwygChannelParent_h