зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 2cd25cde565b (bug 782542) a=orange
This commit is contained in:
Родитель
469925fb2c
Коммит
a9c244ced0
|
@ -112,10 +112,6 @@ function setUp() {
|
|||
SpecialPowers.setBoolPref("dom.ipc.browser_frames.oop_by_default", true);
|
||||
SpecialPowers.addPermission("browser", true, window.document);
|
||||
SpecialPowers.addPermission("embed-apps", true, window.document);
|
||||
|
||||
// TODO: remove in bug 820712
|
||||
SpecialPowers.setBoolPref("network.disable.ipc.security", true);
|
||||
|
||||
runNextTest();
|
||||
}
|
||||
|
||||
|
@ -140,10 +136,6 @@ function makeKillTest(isApp) function testKill() {
|
|||
function tearDown() {
|
||||
SpecialPowers.clearUserPref("dom.mozBrowserFramesEnabled");
|
||||
SpecialPowers.clearUserPref("dom.ipc.browser_frames.oop_by_default");
|
||||
|
||||
// TODO: remove in bug 820712
|
||||
SpecialPowers.clearUserPref("network.disable.ipc.security");
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
load 257752-1-recursion.xul
|
||||
load 329335-1.xul
|
||||
load 329884-1.xul
|
||||
skip-if(winWidget||browserIsRemote) HTTP load 330010-1.xul # bugs 742455 and 823470
|
||||
skip-if(winWidget) HTTP load 330010-1.xul # bug 742455
|
||||
skip-if(winWidget) load 330012-1.xul # bug 742455
|
||||
skip-if(winWidget) load 397148-1.xul # bug 742455
|
||||
load 404346-1.xul
|
||||
|
|
|
@ -8,12 +8,22 @@
|
|||
#include "nsIScriptSecurityManager.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "mozIApplication.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
NS_IMPL_ISUPPORTS1(LoadContext, nsILoadContext);
|
||||
|
||||
LoadContext::LoadContext(const IPC::SerializedLoadContext& aToCopy,
|
||||
nsIDOMElement* aTopFrameElemenet)
|
||||
: mIsNotNull(aToCopy.mIsNotNull)
|
||||
, mIsContent(aToCopy.mIsContent)
|
||||
, mUsePrivateBrowsing(aToCopy.mUsePrivateBrowsing)
|
||||
, mIsInBrowserElement(aToCopy.mIsInBrowserElement)
|
||||
, mAppId(aToCopy.mAppId)
|
||||
, mTopFrameElement(do_GetWeakReference(aTopFrameElemenet))
|
||||
{}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// LoadContext::nsILoadContext
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
|
@ -10,9 +10,6 @@
|
|||
#include "SerializedLoadContext.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include "nsIDOMElement.h"
|
||||
|
||||
class mozIApplication;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
|
@ -32,19 +29,17 @@ public:
|
|||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSILOADCONTEXT
|
||||
|
||||
// AppId/inBrowser arguments override those in SerializedLoadContext provided
|
||||
// by child process.
|
||||
LoadContext(const IPC::SerializedLoadContext& aToCopy,
|
||||
nsIDOMElement* aTopFrameElement,
|
||||
uint32_t aAppId, bool aInBrowser)
|
||||
LoadContext(const IPC::SerializedLoadContext& aToCopy)
|
||||
: mIsNotNull(aToCopy.mIsNotNull)
|
||||
, mIsContent(aToCopy.mIsContent)
|
||||
, mUsePrivateBrowsing(aToCopy.mUsePrivateBrowsing)
|
||||
, mIsInBrowserElement(aInBrowser)
|
||||
, mAppId(aAppId)
|
||||
, mTopFrameElement(do_GetWeakReference(aTopFrameElement))
|
||||
, mIsInBrowserElement(aToCopy.mIsInBrowserElement)
|
||||
, mAppId(aToCopy.mAppId)
|
||||
{}
|
||||
|
||||
LoadContext(const IPC::SerializedLoadContext& aToCopy,
|
||||
nsIDOMElement* aTopFrameElemenet);
|
||||
|
||||
private:
|
||||
bool mIsNotNull;
|
||||
bool mIsContent;
|
||||
|
|
|
@ -65,14 +65,6 @@ const browserElementTestHelpers = {
|
|||
return this._setBoolPref("dom.ipc.browser_frames.oop_by_default", value);
|
||||
},
|
||||
|
||||
getIPCSecurityDisabledPref: function() {
|
||||
return this._getBoolPref("network.disable.ipc.security");
|
||||
},
|
||||
|
||||
setIPCSecurityDisabledPref: function(value) {
|
||||
return this._setBoolPref("network.disable.ipc.security", value);
|
||||
},
|
||||
|
||||
getPageThumbsEnabledPref: function() {
|
||||
return this._getBoolPref('browser.pageThumbs.enabled');
|
||||
},
|
||||
|
@ -102,7 +94,6 @@ const browserElementTestHelpers = {
|
|||
this.setOOPDisabledPref(this.origOOPDisabledPref);
|
||||
this.setOOPByDefaultPref(this.origOOPByDefaultPref);
|
||||
this.setPageThumbsEnabledPref(this.origPageThumbsEnabledPref);
|
||||
this.setIPCSecurityDisabledPref(this.origIPCSecurityPref);
|
||||
this.removeAllTempPermissions();
|
||||
},
|
||||
|
||||
|
@ -110,7 +101,6 @@ const browserElementTestHelpers = {
|
|||
'origOOPDisabledPref': null,
|
||||
'origOOPByDefaultPref': null,
|
||||
'origPageThumbsEnabledPref': null,
|
||||
'origIPCSecurityPref': null,
|
||||
'tempPermissions': [],
|
||||
|
||||
// Some basically-empty pages from different domains you can load.
|
||||
|
@ -132,7 +122,6 @@ browserElementTestHelpers.origEnabledPref = browserElementTestHelpers.getEnabled
|
|||
browserElementTestHelpers.origOOPDisabledPref = browserElementTestHelpers.getOOPDisabledPref();
|
||||
browserElementTestHelpers.origOOPByDefaultPref = browserElementTestHelpers.getOOPByDefaultPref();
|
||||
browserElementTestHelpers.origPageThumbsEnabledPref = browserElementTestHelpers.getPageThumbsEnabledPref();
|
||||
browserElementTestHelpers.origIPCSecurityPref = browserElementTestHelpers.getIPCSecurityDisabledPref();
|
||||
|
||||
// Disable tab view; it seriously messes us up.
|
||||
browserElementTestHelpers.setPageThumbsEnabledPref(false);
|
||||
|
@ -144,10 +133,6 @@ var oop = location.pathname.indexOf('_inproc_') == -1;
|
|||
browserElementTestHelpers.setOOPByDefaultPref(oop);
|
||||
browserElementTestHelpers.setOOPDisabledPref(false);
|
||||
|
||||
// Disable the networking security checks; our test harness just tests browser elements
|
||||
// without sticking them in apps, and the security checks dislike that.
|
||||
browserElementTestHelpers.setIPCSecurityDisabledPref(true);
|
||||
|
||||
addEventListener('unload', function() {
|
||||
browserElementTestHelpers.restoreOriginalPrefs();
|
||||
});
|
||||
|
|
|
@ -153,9 +153,6 @@
|
|||
["device.storage.testing", true],
|
||||
["device.storage.prompt.testing", true],
|
||||
|
||||
// TODO: remove this as part of bug 820712
|
||||
["network.disable.ipc.security", true],
|
||||
|
||||
["dom.ipc.browser_frames.oop_by_default", true],
|
||||
["dom.mozBrowserFramesEnabled", true],
|
||||
["browser.pageThumbs.enabled", false]
|
||||
|
|
|
@ -168,9 +168,6 @@
|
|||
SpecialPowers.addPermission("browser", true, document);
|
||||
SpecialPowers.pushPrefEnv({
|
||||
"set": [
|
||||
// TODO: remove this as part of bug 820712
|
||||
["network.disable.ipc.security", true],
|
||||
|
||||
["dom.ipc.browser_frames.oop_by_default", true],
|
||||
["dom.mozBrowserFramesEnabled", true]
|
||||
]
|
||||
|
|
|
@ -159,10 +159,5 @@ if (!SpecialPowers.isMainProcess()) {
|
|||
todo(false, "We should make this work on content process");
|
||||
SimpleTest.finish();
|
||||
} else {
|
||||
// TODO: remove unsetting network.disable.ipc.security as part of bug 820712
|
||||
SpecialPowers.pushPrefEnv({
|
||||
"set": [
|
||||
["network.disable.ipc.security", true],
|
||||
]
|
||||
}, startTest);
|
||||
startTest();
|
||||
}
|
||||
|
|
|
@ -215,6 +215,8 @@ parent:
|
|||
* URI of the manifest to fetch, the application cache group ID
|
||||
* @param documentURI
|
||||
* URI of the document that referred the manifest
|
||||
* @param clientID
|
||||
* The group cache version identifier to use
|
||||
* @param stickDocument
|
||||
* True if the update was initiated by a document load that referred
|
||||
* a manifest.
|
||||
|
@ -232,6 +234,7 @@ parent:
|
|||
* has already been cached (stickDocument=false).
|
||||
*/
|
||||
POfflineCacheUpdate(URIParams manifestURI, URIParams documentURI,
|
||||
bool isInBrowserElement, uint32_t appId,
|
||||
bool stickDocument);
|
||||
|
||||
sync PIndexedDB(nsCString asciiOrigin)
|
||||
|
|
|
@ -1573,6 +1573,8 @@ TabChild::RecvActivateFrameEvent(const nsString& aType, const bool& capture)
|
|||
POfflineCacheUpdateChild*
|
||||
TabChild::AllocPOfflineCacheUpdate(const URIParams& manifestURI,
|
||||
const URIParams& documentURI,
|
||||
const bool& isInBrowserElement,
|
||||
const uint32_t& appId,
|
||||
const bool& stickDocument)
|
||||
{
|
||||
NS_RUNTIMEABORT("unused");
|
||||
|
|
|
@ -277,6 +277,8 @@ public:
|
|||
virtual POfflineCacheUpdateChild* AllocPOfflineCacheUpdate(
|
||||
const URIParams& manifestURI,
|
||||
const URIParams& documentURI,
|
||||
const bool& isInBrowserElement,
|
||||
const uint32_t& appId,
|
||||
const bool& stickDocument);
|
||||
virtual bool DeallocPOfflineCacheUpdate(POfflineCacheUpdateChild* offlineCacheUpdate);
|
||||
|
||||
|
|
|
@ -1131,13 +1131,15 @@ TabParent::DeallocPRenderFrame(PRenderFrameParent* aFrame)
|
|||
mozilla::docshell::POfflineCacheUpdateParent*
|
||||
TabParent::AllocPOfflineCacheUpdate(const URIParams& aManifestURI,
|
||||
const URIParams& aDocumentURI,
|
||||
const bool& isInBrowserElement,
|
||||
const uint32_t& appId,
|
||||
const bool& stickDocument)
|
||||
{
|
||||
nsRefPtr<mozilla::docshell::OfflineCacheUpdateParent> update =
|
||||
new mozilla::docshell::OfflineCacheUpdateParent(OwnOrContainingAppId(),
|
||||
IsBrowserElement());
|
||||
new mozilla::docshell::OfflineCacheUpdateParent();
|
||||
|
||||
nsresult rv = update->Schedule(aManifestURI, aDocumentURI, stickDocument);
|
||||
nsresult rv = update->Schedule(aManifestURI, aDocumentURI,
|
||||
isInBrowserElement, appId, stickDocument);
|
||||
if (NS_FAILED(rv))
|
||||
return nullptr;
|
||||
|
||||
|
|
|
@ -190,6 +190,8 @@ public:
|
|||
virtual POfflineCacheUpdateParent* AllocPOfflineCacheUpdate(
|
||||
const URIParams& aManifestURI,
|
||||
const URIParams& aDocumentURI,
|
||||
const bool& isInBrowserElement,
|
||||
const uint32_t& appId,
|
||||
const bool& stickDocument);
|
||||
virtual bool DeallocPOfflineCacheUpdate(POfflineCacheUpdateParent* actor);
|
||||
|
||||
|
|
|
@ -4,14 +4,12 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "mozilla/net/CookieServiceChild.h"
|
||||
#include "mozilla/dom/TabChild.h"
|
||||
|
||||
#include "mozilla/ipc/URIUtils.h"
|
||||
#include "mozilla/net/NeckoChild.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsIPrefService.h"
|
||||
#include "nsIPrefBranch.h"
|
||||
#include "nsITabChild.h"
|
||||
#include "nsNetUtil.h"
|
||||
|
||||
using namespace mozilla::ipc;
|
||||
|
||||
|
@ -117,19 +115,10 @@ CookieServiceChild::GetCookieStringInternal(nsIURI *aHostURI,
|
|||
URIParams uriParams;
|
||||
SerializeURI(aHostURI, uriParams);
|
||||
|
||||
nsCOMPtr<nsITabChild> iTabChild;
|
||||
mozilla::dom::TabChild* tabChild = nullptr;
|
||||
if (aChannel) {
|
||||
NS_QueryNotificationCallbacks(aChannel, iTabChild);
|
||||
if (iTabChild) {
|
||||
tabChild = static_cast<mozilla::dom::TabChild*>(iTabChild.get());
|
||||
}
|
||||
}
|
||||
|
||||
// Synchronously call the parent.
|
||||
nsAutoCString result;
|
||||
SendGetCookieString(uriParams, !!isForeign, aFromHttp,
|
||||
IPC::SerializedLoadContext(aChannel), tabChild, &result);
|
||||
IPC::SerializedLoadContext(aChannel), &result);
|
||||
if (!result.IsEmpty())
|
||||
*aCookieString = ToNewCString(result);
|
||||
|
||||
|
@ -159,18 +148,9 @@ CookieServiceChild::SetCookieStringInternal(nsIURI *aHostURI,
|
|||
URIParams uriParams;
|
||||
SerializeURI(aHostURI, uriParams);
|
||||
|
||||
nsCOMPtr<nsITabChild> iTabChild;
|
||||
mozilla::dom::TabChild* tabChild = nullptr;
|
||||
if (aChannel) {
|
||||
NS_QueryNotificationCallbacks(aChannel, iTabChild);
|
||||
if (iTabChild) {
|
||||
tabChild = static_cast<mozilla::dom::TabChild*>(iTabChild.get());
|
||||
}
|
||||
}
|
||||
|
||||
// Synchronously call the parent.
|
||||
SendSetCookieString(uriParams, !!isForeign, cookieString, serverTime,
|
||||
aFromHttp, IPC::SerializedLoadContext(aChannel), tabChild);
|
||||
aFromHttp, IPC::SerializedLoadContext(aChannel));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -4,44 +4,16 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "mozilla/net/CookieServiceParent.h"
|
||||
#include "mozilla/dom/PBrowserParent.h"
|
||||
#include "mozilla/net/NeckoParent.h"
|
||||
|
||||
#include "mozilla/ipc/URIUtils.h"
|
||||
#include "nsCookieService.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsPrintfCString.h"
|
||||
|
||||
using namespace mozilla::ipc;
|
||||
using mozilla::dom::PBrowserParent;
|
||||
using mozilla::net::NeckoParent;
|
||||
|
||||
namespace mozilla {
|
||||
namespace net {
|
||||
|
||||
MOZ_WARN_UNUSED_RESULT
|
||||
static bool
|
||||
GetAppInfoFromParams(const IPC::SerializedLoadContext &aLoadContext,
|
||||
PBrowserParent* aBrowser,
|
||||
uint32_t& aAppId,
|
||||
bool& aIsInBrowserElement)
|
||||
{
|
||||
aAppId = NECKO_NO_APP_ID;
|
||||
aIsInBrowserElement = false;
|
||||
|
||||
const char* error = NeckoParent::GetValidatedAppInfo(aLoadContext, aBrowser,
|
||||
&aAppId,
|
||||
&aIsInBrowserElement);
|
||||
if (error) {
|
||||
NS_WARNING(nsPrintfCString("CookieServiceParent: GetAppInfoFromParams: "
|
||||
"FATAL error: %s: KILLING CHILD PROCESS\n",
|
||||
error).get());
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
CookieServiceParent::CookieServiceParent()
|
||||
{
|
||||
// Instantiate the cookieservice via the service manager, so it sticks around
|
||||
|
@ -64,7 +36,6 @@ CookieServiceParent::RecvGetCookieString(const URIParams& aHost,
|
|||
const bool& aFromHttp,
|
||||
const IPC::SerializedLoadContext&
|
||||
aLoadContext,
|
||||
PBrowserParent* aBrowser,
|
||||
nsCString* aResult)
|
||||
{
|
||||
if (!mCookieService)
|
||||
|
@ -78,11 +49,7 @@ CookieServiceParent::RecvGetCookieString(const URIParams& aHost,
|
|||
|
||||
uint32_t appId;
|
||||
bool isInBrowserElement;
|
||||
bool valid = GetAppInfoFromParams(aLoadContext, aBrowser, appId,
|
||||
isInBrowserElement);
|
||||
if (!valid) {
|
||||
return false;
|
||||
}
|
||||
GetAppInfoFromLoadContext(aLoadContext, appId, isInBrowserElement);
|
||||
|
||||
mCookieService->GetCookieStringInternal(hostURI, aIsForeign, aFromHttp, appId,
|
||||
isInBrowserElement, *aResult);
|
||||
|
@ -96,8 +63,7 @@ CookieServiceParent::RecvSetCookieString(const URIParams& aHost,
|
|||
const nsCString& aServerTime,
|
||||
const bool& aFromHttp,
|
||||
const IPC::SerializedLoadContext&
|
||||
aLoadContext,
|
||||
PBrowserParent* aBrowser)
|
||||
aLoadContext)
|
||||
{
|
||||
if (!mCookieService)
|
||||
return true;
|
||||
|
@ -110,11 +76,7 @@ CookieServiceParent::RecvSetCookieString(const URIParams& aHost,
|
|||
|
||||
uint32_t appId;
|
||||
bool isInBrowserElement;
|
||||
bool valid = GetAppInfoFromParams(aLoadContext, aBrowser, appId,
|
||||
isInBrowserElement);
|
||||
if (!valid) {
|
||||
return false;
|
||||
}
|
||||
GetAppInfoFromLoadContext(aLoadContext, appId, isInBrowserElement);
|
||||
|
||||
nsDependentCString cookieString(aCookieString, 0);
|
||||
mCookieService->SetCookieStringInternal(hostURI, aIsForeign, cookieString,
|
||||
|
@ -123,6 +85,23 @@ CookieServiceParent::RecvSetCookieString(const URIParams& aHost,
|
|||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
CookieServiceParent::GetAppInfoFromLoadContext(
|
||||
const IPC::SerializedLoadContext &aLoadContext,
|
||||
uint32_t& aAppId,
|
||||
bool& aIsInBrowserElement)
|
||||
{
|
||||
// TODO: bug 782542: what to do when we get null loadContext? For now assume
|
||||
// NECKO_NO_APP_ID.
|
||||
aAppId = NECKO_NO_APP_ID;
|
||||
aIsInBrowserElement = false;
|
||||
|
||||
if (aLoadContext.IsNotNull()) {
|
||||
aAppId = aLoadContext.mAppId;
|
||||
aIsInBrowserElement = aLoadContext.mIsInBrowserElement;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,9 +13,6 @@ class nsCookieService;
|
|||
class nsIIOService;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
class PBrowserParent;
|
||||
}
|
||||
namespace net {
|
||||
|
||||
class CookieServiceParent : public PCookieServiceParent
|
||||
|
@ -30,7 +27,6 @@ protected:
|
|||
const bool& aFromHttp,
|
||||
const IPC::SerializedLoadContext&
|
||||
loadContext,
|
||||
mozilla::dom::PBrowserParent* aBrowser,
|
||||
nsCString* aResult);
|
||||
|
||||
virtual bool RecvSetCookieString(const URIParams& aHost,
|
||||
|
@ -39,8 +35,10 @@ protected:
|
|||
const nsCString& aServerTime,
|
||||
const bool& aFromHttp,
|
||||
const IPC::SerializedLoadContext&
|
||||
loadContext,
|
||||
mozilla::dom::PBrowserParent* aBrowser);
|
||||
loadContext);
|
||||
|
||||
void GetAppInfoFromLoadContext(const IPC::SerializedLoadContext& aLoadContext,
|
||||
uint32_t& aAppId, bool& aIsInBrowserElement);
|
||||
|
||||
nsRefPtr<nsCookieService> mCookieService;
|
||||
};
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
include protocol PNecko;
|
||||
include protocol PBrowser;
|
||||
include URIParams;
|
||||
|
||||
include "SerializedLoadContext.h";
|
||||
|
@ -65,8 +64,7 @@ parent:
|
|||
sync GetCookieString(URIParams host,
|
||||
bool isForeign,
|
||||
bool fromHttp,
|
||||
SerializedLoadContext loadContext,
|
||||
nullable PBrowser browser)
|
||||
SerializedLoadContext loadContext)
|
||||
returns (nsCString result);
|
||||
|
||||
/*
|
||||
|
@ -103,8 +101,7 @@ parent:
|
|||
nsCString cookieString,
|
||||
nsCString serverTime,
|
||||
bool fromHttp,
|
||||
SerializedLoadContext loadContext,
|
||||
nullable PBrowser browser);
|
||||
SerializedLoadContext loadContext);
|
||||
|
||||
__delete__();
|
||||
};
|
||||
|
|
|
@ -86,8 +86,7 @@ NeckoChild::DeallocPHttpChannel(PHttpChannelChild* channel)
|
|||
}
|
||||
|
||||
PFTPChannelChild*
|
||||
NeckoChild::AllocPFTPChannel(PBrowserChild* aBrowser,
|
||||
const SerializedLoadContext& aSerialized)
|
||||
NeckoChild::AllocPFTPChannel()
|
||||
{
|
||||
// We don't allocate here: see FTPChannelChild::AsyncOpen()
|
||||
NS_RUNTIMEABORT("AllocPFTPChannel should not be called");
|
||||
|
@ -141,8 +140,7 @@ NeckoChild::DeallocPWyciwygChannel(PWyciwygChannelChild* channel)
|
|||
}
|
||||
|
||||
PWebSocketChild*
|
||||
NeckoChild::AllocPWebSocket(PBrowserChild* browser,
|
||||
const SerializedLoadContext& aSerialized)
|
||||
NeckoChild::AllocPWebSocket(PBrowserChild* browser)
|
||||
{
|
||||
NS_NOTREACHED("AllocPWebSocket should not be called");
|
||||
return nullptr;
|
||||
|
|
|
@ -33,10 +33,9 @@ protected:
|
|||
virtual bool DeallocPCookieService(PCookieServiceChild*);
|
||||
virtual PWyciwygChannelChild* AllocPWyciwygChannel();
|
||||
virtual bool DeallocPWyciwygChannel(PWyciwygChannelChild*);
|
||||
virtual PFTPChannelChild* AllocPFTPChannel(PBrowserChild* aBrowser,
|
||||
const SerializedLoadContext& aSerialized);
|
||||
virtual PFTPChannelChild* AllocPFTPChannel();
|
||||
virtual bool DeallocPFTPChannel(PFTPChannelChild*);
|
||||
virtual PWebSocketChild* AllocPWebSocket(PBrowserChild*, const SerializedLoadContext&);
|
||||
virtual PWebSocketChild* AllocPWebSocket(PBrowserChild*);
|
||||
virtual bool DeallocPWebSocket(PWebSocketChild*);
|
||||
virtual PTCPSocketChild* AllocPTCPSocket(const nsString& aHost,
|
||||
const uint16_t& aPort,
|
||||
|
|
|
@ -17,8 +17,7 @@
|
|||
#include "mozilla/dom/network/TCPSocketParent.h"
|
||||
#include "mozilla/ipc/URIUtils.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/LoadContext.h"
|
||||
#include "nsPrintfCString.h"
|
||||
|
||||
#include "nsHTMLDNSPrefetch.h"
|
||||
#include "nsIAppsService.h"
|
||||
#include "nsEscape.h"
|
||||
|
@ -26,7 +25,6 @@
|
|||
using mozilla::dom::TabParent;
|
||||
using mozilla::net::PTCPSocketParent;
|
||||
using mozilla::dom::TCPSocketParent;
|
||||
using IPC::SerializedLoadContext;
|
||||
|
||||
namespace mozilla {
|
||||
namespace net {
|
||||
|
@ -59,116 +57,11 @@ NeckoParent::~NeckoParent()
|
|||
{
|
||||
}
|
||||
|
||||
static PBOverrideStatus
|
||||
PBOverrideStatusFromLoadContext(const SerializedLoadContext& aSerialized)
|
||||
{
|
||||
if (!aSerialized.IsNotNull() && aSerialized.IsPrivateBitValid()) {
|
||||
return aSerialized.mUsePrivateBrowsing ?
|
||||
kPBOverride_Private :
|
||||
kPBOverride_NotPrivate;
|
||||
}
|
||||
return kPBOverride_Unset;
|
||||
}
|
||||
|
||||
const char*
|
||||
NeckoParent::GetValidatedAppInfo(const SerializedLoadContext& aSerialized,
|
||||
PBrowserParent* aBrowser,
|
||||
uint32_t* aAppId,
|
||||
bool* aInBrowserElement)
|
||||
{
|
||||
if (!gDisableIPCSecurity) {
|
||||
if (!aBrowser) {
|
||||
return "missing required PBrowser argument";
|
||||
}
|
||||
if (!aSerialized.IsNotNull()) {
|
||||
return "SerializedLoadContext from child is null";
|
||||
}
|
||||
}
|
||||
|
||||
*aAppId = NECKO_UNKNOWN_APP_ID;
|
||||
*aInBrowserElement = false;
|
||||
|
||||
if (aBrowser) {
|
||||
nsRefPtr<TabParent> tabParent = static_cast<TabParent*>(aBrowser);
|
||||
|
||||
*aAppId = tabParent->OwnOrContainingAppId();
|
||||
*aInBrowserElement = tabParent->IsBrowserElement();
|
||||
|
||||
if (*aAppId == NECKO_UNKNOWN_APP_ID) {
|
||||
return "TabParent reports appId=NECKO_UNKNOWN_APP_ID!";
|
||||
}
|
||||
// We may get appID=NO_APP if child frame is neither a browser nor an app
|
||||
if (*aAppId == NECKO_NO_APP_ID) {
|
||||
if (tabParent->HasOwnApp()) {
|
||||
return "TabParent reports NECKO_NO_APP_ID but also is an app";
|
||||
}
|
||||
if (!gDisableIPCSecurity && tabParent->IsBrowserElement()) {
|
||||
// <iframe mozbrowser> which doesn't have an <iframe mozapp> above it.
|
||||
// This is not supported now, and we'll need to do a code audit to make
|
||||
// sure we can handle it (i.e don't short-circuit using separate
|
||||
// namespace if just appID==0)
|
||||
return "TabParent reports appId=NECKO_NO_APP_ID but is a mozbrowser";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Only trust appId/inBrowser from child-side loadcontext if we're in
|
||||
// testing mode: allows xpcshell tests to masquerade as apps
|
||||
MOZ_ASSERT(gDisableIPCSecurity);
|
||||
if (!gDisableIPCSecurity) {
|
||||
return "internal error";
|
||||
}
|
||||
if (aSerialized.IsNotNull()) {
|
||||
*aAppId = aSerialized.mAppId;
|
||||
*aInBrowserElement = aSerialized.mIsInBrowserElement;
|
||||
} else {
|
||||
*aAppId = NECKO_NO_APP_ID;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const char *
|
||||
NeckoParent::CreateChannelLoadContext(PBrowserParent* aBrowser,
|
||||
const SerializedLoadContext& aSerialized,
|
||||
nsCOMPtr<nsILoadContext> &aResult)
|
||||
{
|
||||
uint32_t appId = NECKO_UNKNOWN_APP_ID;
|
||||
bool inBrowser = false;
|
||||
nsIDOMElement* topFrameElement = nullptr;
|
||||
const char* error = GetValidatedAppInfo(aSerialized, aBrowser, &appId, &inBrowser);
|
||||
if (error) {
|
||||
return error;
|
||||
}
|
||||
|
||||
if (aBrowser) {
|
||||
nsRefPtr<TabParent> tabParent = static_cast<TabParent*>(aBrowser);
|
||||
topFrameElement = tabParent->GetOwnerElement();
|
||||
}
|
||||
|
||||
// if gDisableIPCSecurity, we may not have a LoadContext to set. This is
|
||||
// the common case for most xpcshell tests.
|
||||
if (aSerialized.IsNotNull()) {
|
||||
aResult = new LoadContext(aSerialized, topFrameElement, appId, inBrowser);
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PHttpChannelParent*
|
||||
NeckoParent::AllocPHttpChannel(PBrowserParent* aBrowser,
|
||||
const SerializedLoadContext& aSerialized)
|
||||
NeckoParent::AllocPHttpChannel(PBrowserParent* browser,
|
||||
const SerializedLoadContext& loadContext)
|
||||
{
|
||||
nsCOMPtr<nsILoadContext> loadContext;
|
||||
const char *error = CreateChannelLoadContext(aBrowser, aSerialized,
|
||||
loadContext);
|
||||
if (error) {
|
||||
NS_WARNING(nsPrintfCString("NeckoParent::AllocPHttpChannel: "
|
||||
"FATAL error: %s: KILLING CHILD PROCESS\n",
|
||||
error).get());
|
||||
return nullptr;
|
||||
}
|
||||
PBOverrideStatus overrideStatus = PBOverrideStatusFromLoadContext(aSerialized);
|
||||
HttpChannelParent *p = new HttpChannelParent(aBrowser, loadContext, overrideStatus);
|
||||
HttpChannelParent *p = new HttpChannelParent(browser, loadContext);
|
||||
p->AddRef();
|
||||
return p;
|
||||
}
|
||||
|
@ -182,20 +75,9 @@ NeckoParent::DeallocPHttpChannel(PHttpChannelParent* channel)
|
|||
}
|
||||
|
||||
PFTPChannelParent*
|
||||
NeckoParent::AllocPFTPChannel(PBrowserParent* aBrowser,
|
||||
const SerializedLoadContext& aSerialized)
|
||||
NeckoParent::AllocPFTPChannel()
|
||||
{
|
||||
nsCOMPtr<nsILoadContext> loadContext;
|
||||
const char *error = CreateChannelLoadContext(aBrowser, aSerialized,
|
||||
loadContext);
|
||||
if (error) {
|
||||
NS_WARNING(nsPrintfCString("NeckoParent::AllocPFTPChannel: "
|
||||
"FATAL error: %s: KILLING CHILD PROCESS\n",
|
||||
error).get());
|
||||
return nullptr;
|
||||
}
|
||||
PBOverrideStatus overrideStatus = PBOverrideStatusFromLoadContext(aSerialized);
|
||||
FTPChannelParent *p = new FTPChannelParent(loadContext, overrideStatus);
|
||||
FTPChannelParent *p = new FTPChannelParent();
|
||||
p->AddRef();
|
||||
return p;
|
||||
}
|
||||
|
@ -238,23 +120,10 @@ NeckoParent::DeallocPWyciwygChannel(PWyciwygChannelParent* channel)
|
|||
}
|
||||
|
||||
PWebSocketParent*
|
||||
NeckoParent::AllocPWebSocket(PBrowserParent* browser,
|
||||
const SerializedLoadContext& serialized)
|
||||
NeckoParent::AllocPWebSocket(PBrowserParent* browser)
|
||||
{
|
||||
nsCOMPtr<nsILoadContext> loadContext;
|
||||
const char *error = CreateChannelLoadContext(browser, serialized,
|
||||
loadContext);
|
||||
if (error) {
|
||||
NS_WARNING(nsPrintfCString("NeckoParent::AllocPWebSocket: "
|
||||
"FATAL error: %s: KILLING CHILD PROCESS\n",
|
||||
error).get());
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
TabParent* tabParent = static_cast<TabParent*>(browser);
|
||||
PBOverrideStatus overrideStatus = PBOverrideStatusFromLoadContext(serialized);
|
||||
WebSocketChannelParent* p = new WebSocketChannelParent(tabParent, loadContext,
|
||||
overrideStatus);
|
||||
WebSocketChannelParent* p = new WebSocketChannelParent(tabParent);
|
||||
p->AddRef();
|
||||
return p;
|
||||
}
|
||||
|
|
|
@ -14,13 +14,6 @@
|
|||
namespace mozilla {
|
||||
namespace net {
|
||||
|
||||
// Used to override channel Private Browsing status if needed.
|
||||
enum PBOverrideStatus {
|
||||
kPBOverride_Unset = 0,
|
||||
kPBOverride_Private,
|
||||
kPBOverride_NotPrivate
|
||||
};
|
||||
|
||||
// Header file contents
|
||||
class NeckoParent :
|
||||
public PNeckoParent
|
||||
|
@ -29,27 +22,6 @@ public:
|
|||
NeckoParent();
|
||||
virtual ~NeckoParent();
|
||||
|
||||
MOZ_WARN_UNUSED_RESULT
|
||||
static const char *
|
||||
GetValidatedAppInfo(const SerializedLoadContext& aSerialized,
|
||||
PBrowserParent* aBrowser,
|
||||
uint32_t* aAppId,
|
||||
bool* aInBrowserElement);
|
||||
|
||||
/*
|
||||
* Creates LoadContext for parent-side of an e10s channel.
|
||||
*
|
||||
* Values from PBrowserParent are more secure, and override those set in
|
||||
* SerializedLoadContext.
|
||||
*
|
||||
* Returns null if successful, or an error string if failed.
|
||||
*/
|
||||
MOZ_WARN_UNUSED_RESULT
|
||||
static const char*
|
||||
CreateChannelLoadContext(PBrowserParent* aBrowser,
|
||||
const SerializedLoadContext& aSerialized,
|
||||
nsCOMPtr<nsILoadContext> &aResult);
|
||||
|
||||
protected:
|
||||
virtual PHttpChannelParent* AllocPHttpChannel(PBrowserParent*,
|
||||
const SerializedLoadContext&);
|
||||
|
@ -58,11 +30,9 @@ protected:
|
|||
virtual bool DeallocPCookieService(PCookieServiceParent*);
|
||||
virtual PWyciwygChannelParent* AllocPWyciwygChannel();
|
||||
virtual bool DeallocPWyciwygChannel(PWyciwygChannelParent*);
|
||||
virtual PFTPChannelParent* AllocPFTPChannel(PBrowserParent* aBrowser,
|
||||
const SerializedLoadContext& aSerialized);
|
||||
virtual PFTPChannelParent* AllocPFTPChannel();
|
||||
virtual bool DeallocPFTPChannel(PFTPChannelParent*);
|
||||
virtual PWebSocketParent* AllocPWebSocket(PBrowserParent* browser,
|
||||
const SerializedLoadContext& aSerialized);
|
||||
virtual PWebSocketParent* AllocPWebSocket(PBrowserParent* browser);
|
||||
virtual bool DeallocPWebSocket(PWebSocketParent*);
|
||||
virtual PTCPSocketParent* AllocPTCPSocket(const nsString& aHost,
|
||||
const uint16_t& aPort,
|
||||
|
@ -86,6 +56,7 @@ protected:
|
|||
virtual bool RecvCancelHTMLDNSPrefetch(const nsString& hostname,
|
||||
const uint16_t& flags,
|
||||
const nsresult& reason);
|
||||
|
||||
private:
|
||||
nsCString mCoreAppsBasePath;
|
||||
nsCString mWebAppsBasePath;
|
||||
|
|
|
@ -43,8 +43,8 @@ parent:
|
|||
PHttpChannel(nullable PBrowser browser,
|
||||
SerializedLoadContext loadContext);
|
||||
PWyciwygChannel();
|
||||
PFTPChannel(PBrowser browser, SerializedLoadContext loadContext);
|
||||
PWebSocket(PBrowser browser, SerializedLoadContext loadContext);
|
||||
PFTPChannel();
|
||||
PWebSocket(PBrowser browser);
|
||||
PTCPSocket(nsString host, uint16_t port, bool useSSL, nsString binaryType,
|
||||
nullable PBrowser browser);
|
||||
PRemoteOpenFile(URIParams fileuri, nullable PBrowser browser);
|
||||
|
|
|
@ -7,9 +7,8 @@
|
|||
|
||||
#include "mozilla/net/NeckoChild.h"
|
||||
#include "mozilla/net/FTPChannelChild.h"
|
||||
#include "mozilla/dom/TabChild.h"
|
||||
#include "nsFtpProtocolHandler.h"
|
||||
#include "nsITabChild.h"
|
||||
|
||||
#include "nsStringStream.h"
|
||||
#include "nsMimeTypes.h"
|
||||
#include "nsNetUtil.h"
|
||||
|
@ -156,18 +155,8 @@ FTPChannelChild::AsyncOpen(::nsIStreamListener* listener, nsISupports* aContext)
|
|||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
mozilla::dom::TabChild* tabChild = nullptr;
|
||||
nsCOMPtr<nsITabChild> iTabChild;
|
||||
NS_QueryNotificationCallbacks(mCallbacks, mLoadGroup,
|
||||
NS_GET_IID(nsITabChild),
|
||||
getter_AddRefs(iTabChild));
|
||||
GetCallback(iTabChild);
|
||||
if (iTabChild) {
|
||||
tabChild = static_cast<mozilla::dom::TabChild*>(iTabChild.get());
|
||||
}
|
||||
|
||||
// FIXME: like bug 558623, merge constructor+SendAsyncOpen into 1 IPC msg
|
||||
gNeckoChild->SendPFTPChannelConstructor(this, tabChild, IPC::SerializedLoadContext(this));
|
||||
gNeckoChild->SendPFTPChannelConstructor(this);
|
||||
mListener = listener;
|
||||
mListenerContext = aContext;
|
||||
|
||||
|
@ -181,7 +170,8 @@ FTPChannelChild::AsyncOpen(::nsIStreamListener* listener, nsISupports* aContext)
|
|||
OptionalInputStreamParams uploadStream;
|
||||
SerializeInputStream(mUploadStream, uploadStream);
|
||||
|
||||
SendAsyncOpen(uri, mStartPos, mEntityID, uploadStream);
|
||||
SendAsyncOpen(uri, mStartPos, mEntityID, uploadStream,
|
||||
IPC::SerializedLoadContext(this));
|
||||
|
||||
// The socket transport layer in the chrome process now has a logical ref to
|
||||
// us until OnStopRequest is called.
|
||||
|
@ -519,22 +509,11 @@ FTPChannelChild::Resume()
|
|||
NS_IMETHODIMP
|
||||
FTPChannelChild::ConnectParent(uint32_t id)
|
||||
{
|
||||
mozilla::dom::TabChild* tabChild = nullptr;
|
||||
nsCOMPtr<nsITabChild> iTabChild;
|
||||
NS_QueryNotificationCallbacks(mCallbacks, mLoadGroup,
|
||||
NS_GET_IID(nsITabChild),
|
||||
getter_AddRefs(iTabChild));
|
||||
GetCallback(iTabChild);
|
||||
if (iTabChild) {
|
||||
tabChild = static_cast<mozilla::dom::TabChild*>(iTabChild.get());
|
||||
}
|
||||
|
||||
// The socket transport in the chrome process now holds a logical ref to us
|
||||
// until OnStopRequest, or we do a redirect, or we hit an IPDL error.
|
||||
AddIPDLReference();
|
||||
|
||||
if (!gNeckoChild->SendPFTPChannelConstructor(this, tabChild,
|
||||
IPC::SerializedLoadContext(this)))
|
||||
if (!gNeckoChild->SendPFTPChannelConstructor(this))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
if (!SendConnectChannel(id))
|
||||
|
|
|
@ -23,10 +23,8 @@ using namespace mozilla::ipc;
|
|||
namespace mozilla {
|
||||
namespace net {
|
||||
|
||||
FTPChannelParent::FTPChannelParent(nsILoadContext* aLoadContext, PBOverrideStatus aOverrideStatus)
|
||||
FTPChannelParent::FTPChannelParent()
|
||||
: mIPCClosed(false)
|
||||
, mLoadContext(aLoadContext)
|
||||
, mPBOverride(aOverrideStatus)
|
||||
{
|
||||
nsIProtocolHandler* handler;
|
||||
CallGetService(NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "ftp", &handler);
|
||||
|
@ -64,7 +62,8 @@ bool
|
|||
FTPChannelParent::RecvAsyncOpen(const URIParams& aURI,
|
||||
const uint64_t& aStartPos,
|
||||
const nsCString& aEntityID,
|
||||
const OptionalInputStreamParams& aUploadStream)
|
||||
const OptionalInputStreamParams& aUploadStream,
|
||||
const IPC::SerializedLoadContext& loadContext)
|
||||
{
|
||||
nsCOMPtr<nsIURI> uri = DeserializeURI(aURI);
|
||||
if (!uri)
|
||||
|
@ -89,10 +88,6 @@ FTPChannelParent::RecvAsyncOpen(const URIParams& aURI,
|
|||
|
||||
mChannel = static_cast<nsFtpChannel*>(chan.get());
|
||||
|
||||
if (mPBOverride != kPBOverride_Unset) {
|
||||
mChannel->SetPrivate(mPBOverride == kPBOverride_Private ? true : false);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIInputStream> upload = DeserializeInputStream(aUploadStream);
|
||||
if (upload) {
|
||||
// contentType and contentLength are ignored
|
||||
|
@ -105,6 +100,14 @@ FTPChannelParent::RecvAsyncOpen(const URIParams& aURI,
|
|||
if (NS_FAILED(rv))
|
||||
return SendFailedAsyncOpen(rv);
|
||||
|
||||
if (loadContext.IsNotNull())
|
||||
mLoadContext = new LoadContext(loadContext);
|
||||
else if (loadContext.IsPrivateBitValid()) {
|
||||
nsCOMPtr<nsIPrivateBrowsingChannel> pbChannel = do_QueryInterface(chan);
|
||||
if (pbChannel)
|
||||
pbChannel->SetPrivate(loadContext.mUsePrivateBrowsing);
|
||||
}
|
||||
|
||||
rv = mChannel->AsyncOpen(this, nullptr);
|
||||
if (NS_FAILED(rv))
|
||||
return SendFailedAsyncOpen(rv);
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
|
||||
#include "mozilla/net/PFTPChannelParent.h"
|
||||
#include "mozilla/net/NeckoCommon.h"
|
||||
#include "mozilla/net/NeckoParent.h"
|
||||
#include "nsIParentChannel.h"
|
||||
#include "nsIInterfaceRequestor.h"
|
||||
#include "nsILoadContext.h"
|
||||
|
@ -31,14 +30,15 @@ public:
|
|||
NS_DECL_NSIPARENTCHANNEL
|
||||
NS_DECL_NSIINTERFACEREQUESTOR
|
||||
|
||||
FTPChannelParent(nsILoadContext* aLoadContext, PBOverrideStatus aOverrideStatus);
|
||||
FTPChannelParent();
|
||||
virtual ~FTPChannelParent();
|
||||
|
||||
protected:
|
||||
virtual bool RecvAsyncOpen(const URIParams& uri,
|
||||
const uint64_t& startPos,
|
||||
const nsCString& entityID,
|
||||
const OptionalInputStreamParams& uploadStream) MOZ_OVERRIDE;
|
||||
const OptionalInputStreamParams& uploadStream,
|
||||
const IPC::SerializedLoadContext& loadContext) MOZ_OVERRIDE;
|
||||
virtual bool RecvConnectChannel(const uint32_t& channelId) MOZ_OVERRIDE;
|
||||
virtual bool RecvCancel(const nsresult& status) MOZ_OVERRIDE;
|
||||
virtual bool RecvSuspend() MOZ_OVERRIDE;
|
||||
|
@ -51,8 +51,6 @@ protected:
|
|||
bool mIPCClosed;
|
||||
|
||||
nsCOMPtr<nsILoadContext> mLoadContext;
|
||||
|
||||
PBOverrideStatus mPBOverride;
|
||||
};
|
||||
|
||||
} // namespace net
|
||||
|
|
|
@ -13,6 +13,7 @@ include protocol PBlob; //FIXME: bug #792908
|
|||
|
||||
include "SerializedLoadContext.h";
|
||||
|
||||
using IPC::SerializedLoadContext;
|
||||
using PRTime;
|
||||
|
||||
namespace mozilla {
|
||||
|
@ -28,7 +29,8 @@ parent:
|
|||
AsyncOpen(URIParams uri,
|
||||
uint64_t startPos,
|
||||
nsCString entityID,
|
||||
OptionalInputStreamParams uploadStream);
|
||||
OptionalInputStreamParams uploadStream,
|
||||
SerializedLoadContext loadContext);
|
||||
|
||||
ConnectChannel(uint32_t channelId);
|
||||
Cancel(nsresult status);
|
||||
|
|
|
@ -34,8 +34,7 @@ namespace mozilla {
|
|||
namespace net {
|
||||
|
||||
HttpChannelParent::HttpChannelParent(PBrowserParent* iframeEmbedding,
|
||||
nsILoadContext* aLoadContext,
|
||||
PBOverrideStatus aOverrideStatus)
|
||||
const IPC::SerializedLoadContext& loadContext)
|
||||
: mIPCClosed(false)
|
||||
, mStoredStatus(NS_OK)
|
||||
, mStoredProgress(0)
|
||||
|
@ -43,8 +42,7 @@ HttpChannelParent::HttpChannelParent(PBrowserParent* iframeEmbedding,
|
|||
, mSentRedirect1Begin(false)
|
||||
, mSentRedirect1BeginFailed(false)
|
||||
, mReceivedRedirect2Verify(false)
|
||||
, mPBOverride(aOverrideStatus)
|
||||
, mLoadContext(aLoadContext)
|
||||
, mPBOverride(kPBOverride_Unset)
|
||||
{
|
||||
// Ensure gHttpHandler is initialized: we need the atom table up and running.
|
||||
nsIHttpProtocolHandler* handler;
|
||||
|
@ -52,6 +50,18 @@ HttpChannelParent::HttpChannelParent(PBrowserParent* iframeEmbedding,
|
|||
NS_ASSERTION(handler, "no http handler");
|
||||
|
||||
mTabParent = static_cast<mozilla::dom::TabParent*>(iframeEmbedding);
|
||||
|
||||
if (loadContext.IsNotNull()) {
|
||||
if (mTabParent) {
|
||||
mLoadContext = new LoadContext(loadContext, mTabParent->GetOwnerElement());
|
||||
} else {
|
||||
mLoadContext = new LoadContext(loadContext);
|
||||
}
|
||||
} else if (loadContext.IsPrivateBitValid()) {
|
||||
// Don't have channel yet: override PB status after we create it.
|
||||
mPBOverride = loadContext.mUsePrivateBrowsing ? kPBOverride_Private
|
||||
: kPBOverride_NotPrivate;
|
||||
}
|
||||
}
|
||||
|
||||
HttpChannelParent::~HttpChannelParent()
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#include "mozilla/dom/PBrowserParent.h"
|
||||
#include "mozilla/net/PHttpChannelParent.h"
|
||||
#include "mozilla/net/NeckoCommon.h"
|
||||
#include "mozilla/net/NeckoParent.h"
|
||||
#include "nsIParentRedirectingChannel.h"
|
||||
#include "nsIProgressEventSink.h"
|
||||
#include "nsHttpChannel.h"
|
||||
|
@ -45,8 +44,7 @@ public:
|
|||
NS_DECL_NSIINTERFACEREQUESTOR
|
||||
|
||||
HttpChannelParent(mozilla::dom::PBrowserParent* iframeEmbedding,
|
||||
nsILoadContext* aLoadContext,
|
||||
PBOverrideStatus aStatus);
|
||||
const IPC::SerializedLoadContext& loadContext);
|
||||
virtual ~HttpChannelParent();
|
||||
|
||||
protected:
|
||||
|
@ -112,6 +110,12 @@ private:
|
|||
bool mSentRedirect1BeginFailed : 1;
|
||||
bool mReceivedRedirect2Verify : 1;
|
||||
|
||||
// Used to override channel Private Browsing status if needed.
|
||||
enum PBOverrideStatus {
|
||||
kPBOverride_Unset = 0,
|
||||
kPBOverride_Private,
|
||||
kPBOverride_NotPrivate
|
||||
};
|
||||
PBOverrideStatus mPBOverride;
|
||||
|
||||
nsCOMPtr<nsILoadContext> mLoadContext;
|
||||
|
|
|
@ -27,7 +27,8 @@ parent:
|
|||
AsyncOpen(URIParams aURI,
|
||||
nsCString aOrigin,
|
||||
nsCString aProtocol,
|
||||
bool aSecure);
|
||||
bool aSecure,
|
||||
SerializedLoadContext loadContext);
|
||||
Close(uint16_t code, nsCString reason);
|
||||
SendMsg(nsCString aMsg);
|
||||
SendBinaryMsg(nsCString aMsg);
|
||||
|
|
|
@ -338,9 +338,9 @@ WebSocketChannelChild::AsyncOpen(nsIURI *aURI,
|
|||
// Corresponding release in DeallocPWebSocket
|
||||
AddIPDLReference();
|
||||
|
||||
gNeckoChild->SendPWebSocketConstructor(this, tabChild,
|
||||
IPC::SerializedLoadContext(this));
|
||||
if (!SendAsyncOpen(uri, nsCString(aOrigin), mProtocol, mEncrypted))
|
||||
gNeckoChild->SendPWebSocketConstructor(this, tabChild);
|
||||
if (!SendAsyncOpen(uri, nsCString(aOrigin), mProtocol, mEncrypted,
|
||||
IPC::SerializedLoadContext(this)))
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
|
||||
mOriginalURI = aURI;
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include "WebSocketLog.h"
|
||||
#include "WebSocketChannelParent.h"
|
||||
#include "nsIAuthPromptProvider.h"
|
||||
#include "mozilla/LoadContext.h"
|
||||
#include "mozilla/ipc/InputStreamUtils.h"
|
||||
#include "mozilla/ipc/URIUtils.h"
|
||||
|
||||
|
@ -19,15 +20,10 @@ NS_IMPL_THREADSAFE_ISUPPORTS2(WebSocketChannelParent,
|
|||
nsIWebSocketListener,
|
||||
nsIInterfaceRequestor)
|
||||
|
||||
WebSocketChannelParent::WebSocketChannelParent(nsIAuthPromptProvider* aAuthProvider,
|
||||
nsILoadContext* aLoadContext,
|
||||
PBOverrideStatus aOverrideStatus)
|
||||
WebSocketChannelParent::WebSocketChannelParent(nsIAuthPromptProvider* aAuthProvider)
|
||||
: mAuthProvider(aAuthProvider)
|
||||
, mLoadContext(aLoadContext)
|
||||
, mIPCOpen(true)
|
||||
{
|
||||
// Websocket channels can't have a private browsing override
|
||||
MOZ_ASSERT_IF(!aLoadContext, aOverrideStatus == kPBOverride_Unset);
|
||||
#if defined(PR_LOGGING)
|
||||
if (!webSocketLog)
|
||||
webSocketLog = PR_NewLogModule("nsWebSocket");
|
||||
|
@ -51,7 +47,8 @@ bool
|
|||
WebSocketChannelParent::RecvAsyncOpen(const URIParams& aURI,
|
||||
const nsCString& aOrigin,
|
||||
const nsCString& aProtocol,
|
||||
const bool& aSecure)
|
||||
const bool& aSecure,
|
||||
const IPC::SerializedLoadContext& loadContext)
|
||||
{
|
||||
LOG(("WebSocketChannelParent::RecvAsyncOpen() %p\n", this));
|
||||
|
||||
|
@ -68,6 +65,14 @@ WebSocketChannelParent::RecvAsyncOpen(const URIParams& aURI,
|
|||
if (NS_FAILED(rv))
|
||||
goto fail;
|
||||
|
||||
if (loadContext.IsNotNull())
|
||||
mLoadContext = new LoadContext(loadContext);
|
||||
#ifdef DEBUG
|
||||
else
|
||||
// websocket channels cannot have a private bit override
|
||||
MOZ_ASSERT(!loadContext.IsPrivateBitValid());
|
||||
#endif
|
||||
|
||||
rv = mChannel->SetNotificationCallbacks(this);
|
||||
if (NS_FAILED(rv))
|
||||
goto fail;
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
#define mozilla_net_WebSocketChannelParent_h
|
||||
|
||||
#include "mozilla/net/PWebSocketParent.h"
|
||||
#include "mozilla/net/NeckoParent.h"
|
||||
#include "nsIInterfaceRequestor.h"
|
||||
#include "nsIWebSocketListener.h"
|
||||
#include "nsIWebSocketChannel.h"
|
||||
|
@ -30,15 +29,14 @@ class WebSocketChannelParent : public PWebSocketParent,
|
|||
NS_DECL_NSIWEBSOCKETLISTENER
|
||||
NS_DECL_NSIINTERFACEREQUESTOR
|
||||
|
||||
WebSocketChannelParent(nsIAuthPromptProvider* aAuthProvider,
|
||||
nsILoadContext* aLoadContext,
|
||||
PBOverrideStatus aOverrideStatus);
|
||||
WebSocketChannelParent(nsIAuthPromptProvider* aAuthProvider);
|
||||
|
||||
private:
|
||||
bool RecvAsyncOpen(const URIParams& aURI,
|
||||
const nsCString& aOrigin,
|
||||
const nsCString& aProtocol,
|
||||
const bool& aSecure);
|
||||
const bool& aSecure,
|
||||
const IPC::SerializedLoadContext& loadContext);
|
||||
bool RecvClose(const uint16_t & code, const nsCString & reason);
|
||||
bool RecvSendMsg(const nsCString& aMsg);
|
||||
bool RecvSendBinaryMsg(const nsCString& aMsg);
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
include protocol PNecko;
|
||||
include protocol PBrowser;
|
||||
include URIParams;
|
||||
|
||||
include "SerializedLoadContext.h";
|
||||
|
@ -24,8 +23,7 @@ parent:
|
|||
Init(URIParams uri);
|
||||
AsyncOpen(URIParams originalURI,
|
||||
uint32_t loadFlags,
|
||||
SerializedLoadContext loadContext,
|
||||
PBrowser browser);
|
||||
SerializedLoadContext loadContext);
|
||||
|
||||
// methods corresponding to those of nsIWyciwygChannel
|
||||
WriteToCacheEntry(nsString data);
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
|
||||
#include "mozilla/net/NeckoChild.h"
|
||||
#include "WyciwygChannelChild.h"
|
||||
#include "mozilla/dom/TabChild.h"
|
||||
|
||||
#include "nsCharsetSource.h"
|
||||
#include "nsStringStream.h"
|
||||
|
@ -593,16 +592,7 @@ WyciwygChannelChild::AsyncOpen(nsIStreamListener *aListener, nsISupports *aConte
|
|||
URIParams originalURI;
|
||||
SerializeURI(mOriginalURI, originalURI);
|
||||
|
||||
mozilla::dom::TabChild* tabChild = nullptr;
|
||||
nsCOMPtr<nsITabChild> iTabChild;
|
||||
NS_QueryNotificationCallbacks(mCallbacks, mLoadGroup,
|
||||
NS_GET_IID(nsITabChild),
|
||||
getter_AddRefs(iTabChild));
|
||||
if (iTabChild) {
|
||||
tabChild = static_cast<mozilla::dom::TabChild*>(iTabChild.get());
|
||||
}
|
||||
|
||||
SendAsyncOpen(originalURI, mLoadFlags, IPC::SerializedLoadContext(this), tabChild);
|
||||
SendAsyncOpen(originalURI, mLoadFlags, IPC::SerializedLoadContext(this));
|
||||
|
||||
mState = WCC_OPENED;
|
||||
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
#include "nsCharsetSource.h"
|
||||
#include "nsISerializable.h"
|
||||
#include "nsSerializationHelper.h"
|
||||
#include "mozilla/LoadContext.h"
|
||||
#include "mozilla/ipc/URIUtils.h"
|
||||
#include "mozilla/net/NeckoParent.h"
|
||||
|
||||
using namespace mozilla::ipc;
|
||||
|
||||
|
@ -86,8 +86,7 @@ WyciwygChannelParent::RecvInit(const URIParams& aURI)
|
|||
bool
|
||||
WyciwygChannelParent::RecvAsyncOpen(const URIParams& aOriginal,
|
||||
const uint32_t& aLoadFlags,
|
||||
const IPC::SerializedLoadContext& loadContext,
|
||||
PBrowserParent* aParent)
|
||||
const IPC::SerializedLoadContext& loadContext)
|
||||
{
|
||||
nsCOMPtr<nsIURI> original = DeserializeURI(aOriginal);
|
||||
if (!original)
|
||||
|
@ -108,15 +107,9 @@ WyciwygChannelParent::RecvAsyncOpen(const URIParams& aOriginal,
|
|||
if (NS_FAILED(rv))
|
||||
return SendCancelEarly(rv);
|
||||
|
||||
const char* error = NeckoParent::CreateChannelLoadContext(aParent, loadContext,
|
||||
mLoadContext);
|
||||
if (error) {
|
||||
NS_WARNING(nsPrintfCString("WyciwygChannelParent::RecvAsyncOpen: error: %s\n",
|
||||
error).get());
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!mLoadContext && loadContext.IsPrivateBitValid()) {
|
||||
if (loadContext.IsNotNull())
|
||||
mLoadContext = new LoadContext(loadContext);
|
||||
else if (loadContext.IsPrivateBitValid()) {
|
||||
nsCOMPtr<nsIPrivateBrowsingChannel> pbChannel = do_QueryInterface(mChannel);
|
||||
if (pbChannel)
|
||||
pbChannel->SetPrivate(loadContext.mUsePrivateBrowsing);
|
||||
|
|
|
@ -14,10 +14,6 @@
|
|||
#include "nsILoadContext.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
class PBrowserParent;
|
||||
}
|
||||
|
||||
namespace net {
|
||||
|
||||
class WyciwygChannelParent : public PWyciwygChannelParent
|
||||
|
@ -37,8 +33,7 @@ protected:
|
|||
virtual bool RecvInit(const URIParams& uri);
|
||||
virtual bool RecvAsyncOpen(const URIParams& original,
|
||||
const uint32_t& loadFlags,
|
||||
const IPC::SerializedLoadContext& loadContext,
|
||||
PBrowserParent* parent);
|
||||
const IPC::SerializedLoadContext& loadContext);
|
||||
virtual bool RecvWriteToCacheEntry(const nsString& data);
|
||||
virtual bool RecvCloseCacheEntry(const nsresult& reason);
|
||||
virtual bool RecvSetCharsetAndSource(const int32_t& source,
|
||||
|
|
|
@ -440,6 +440,7 @@ OfflineCacheUpdateChild::Schedule()
|
|||
// a reference to us. Will be released in RecvFinish() that identifies
|
||||
// the work has been done.
|
||||
child->SendPOfflineCacheUpdateConstructor(this, manifestURI, documentURI,
|
||||
mInBrowser, mAppID,
|
||||
stickDocument);
|
||||
|
||||
mIPCActivated = true;
|
||||
|
|
|
@ -5,14 +5,12 @@
|
|||
|
||||
#include "OfflineCacheUpdateParent.h"
|
||||
|
||||
#include "mozilla/dom/TabParent.h"
|
||||
#include "mozilla/ipc/URIUtils.h"
|
||||
#include "nsOfflineCacheUpdate.h"
|
||||
#include "nsIApplicationCache.h"
|
||||
#include "nsNetUtil.h"
|
||||
|
||||
using namespace mozilla::ipc;
|
||||
using mozilla::dom::TabParent;
|
||||
|
||||
#if defined(PR_LOGGING)
|
||||
//
|
||||
|
@ -45,11 +43,8 @@ NS_IMPL_ISUPPORTS2(OfflineCacheUpdateParent,
|
|||
// OfflineCacheUpdateParent <public>
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
OfflineCacheUpdateParent::OfflineCacheUpdateParent(uint32_t aAppId,
|
||||
bool aIsInBrowser)
|
||||
OfflineCacheUpdateParent::OfflineCacheUpdateParent()
|
||||
: mIPCClosed(false)
|
||||
, mIsInBrowserElement(aIsInBrowser)
|
||||
, mAppId(aAppId)
|
||||
{
|
||||
// Make sure the service has been initialized
|
||||
nsOfflineCacheUpdateService* service =
|
||||
|
@ -74,6 +69,8 @@ OfflineCacheUpdateParent::ActorDestroy(ActorDestroyReason why)
|
|||
nsresult
|
||||
OfflineCacheUpdateParent::Schedule(const URIParams& aManifestURI,
|
||||
const URIParams& aDocumentURI,
|
||||
const bool& isInBrowserElement,
|
||||
const uint32_t& appId,
|
||||
const bool& stickDocument)
|
||||
{
|
||||
LOG(("OfflineCacheUpdateParent::RecvSchedule [%p]", this));
|
||||
|
@ -103,7 +100,7 @@ OfflineCacheUpdateParent::Schedule(const URIParams& aManifestURI,
|
|||
if (!NS_SecurityCompareURIs(manifestURI, documentURI, false))
|
||||
return NS_ERROR_DOM_SECURITY_ERR;
|
||||
|
||||
service->FindUpdate(manifestURI, mAppId, mIsInBrowserElement,
|
||||
service->FindUpdate(manifestURI, appId, isInBrowserElement,
|
||||
getter_AddRefs(update));
|
||||
if (!update) {
|
||||
update = new nsOfflineCacheUpdate();
|
||||
|
@ -111,7 +108,7 @@ OfflineCacheUpdateParent::Schedule(const URIParams& aManifestURI,
|
|||
// Leave aDocument argument null. Only glues and children keep
|
||||
// document instances.
|
||||
rv = update->Init(manifestURI, documentURI, nullptr, nullptr,
|
||||
mAppId, mIsInBrowserElement);
|
||||
appId, isInBrowserElement);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = update->Schedule();
|
||||
|
|
|
@ -14,10 +14,6 @@
|
|||
|
||||
namespace mozilla {
|
||||
|
||||
namespace dom {
|
||||
class TabParent;
|
||||
}
|
||||
|
||||
namespace ipc {
|
||||
class URIParams;
|
||||
} // namespace ipc
|
||||
|
@ -38,9 +34,11 @@ public:
|
|||
nsresult
|
||||
Schedule(const URIParams& manifestURI,
|
||||
const URIParams& documentURI,
|
||||
const bool& isInBrowserElement,
|
||||
const uint32_t& appId,
|
||||
const bool& stickDocument);
|
||||
|
||||
OfflineCacheUpdateParent(uint32_t aAppId, bool aIsInBrowser);
|
||||
OfflineCacheUpdateParent();
|
||||
~OfflineCacheUpdateParent();
|
||||
|
||||
virtual void ActorDestroy(ActorDestroyReason why);
|
||||
|
|
Загрузка…
Ссылка в новой задаче