mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Back out f99521bfd197:38657fcd2d1a (bug 890570) for Linux xpcshell failures
CLOSED TREE
This commit is contained in:
parent
8ea1abaca9
commit
9675382cca
@ -6,6 +6,7 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
include protocol PNecko;
|
||||
include protocol PBrowser;
|
||||
|
||||
include "mozilla/net/NeckoMessageUtils.h";
|
||||
|
||||
@ -35,7 +36,8 @@ protocol PTCPSocket
|
||||
manager PNecko;
|
||||
|
||||
parent:
|
||||
Open(nsString host, uint16_t port, bool useSSL, nsString binaryType);
|
||||
Open(nsString host, uint16_t port, bool useSSL, nsString binaryType,
|
||||
nullable PBrowser browser);
|
||||
Data(SendableData data);
|
||||
Suspend();
|
||||
Resume();
|
||||
|
@ -91,7 +91,8 @@ TCPSocketChild::Open(nsITCPSocketInternal* aSocket, const nsAString& aHost,
|
||||
}
|
||||
AddIPDLReference();
|
||||
gNeckoChild->SendPTCPSocketConstructor(this);
|
||||
SendOpen(nsString(aHost), aPort, aUseSSL, nsString(aBinaryType));
|
||||
SendOpen(nsString(aHost), aPort, aUseSSL, nsString(aBinaryType),
|
||||
GetTabChildFrom(aWindow));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -11,8 +11,6 @@
|
||||
#include "nsCxPusher.h"
|
||||
#include "mozilla/unused.h"
|
||||
#include "mozilla/AppProcessChecker.h"
|
||||
#include "mozilla/net/NeckoCommon.h"
|
||||
#include "mozilla/net/PNeckoParent.h"
|
||||
|
||||
namespace IPC {
|
||||
|
||||
@ -82,12 +80,11 @@ NS_IMETHODIMP_(nsrefcnt) TCPSocketParent::Release(void)
|
||||
|
||||
bool
|
||||
TCPSocketParent::RecvOpen(const nsString& aHost, const uint16_t& aPort, const bool& aUseSSL,
|
||||
const nsString& aBinaryType)
|
||||
const nsString& aBinaryType, PBrowserParent* aBrowser)
|
||||
{
|
||||
// We don't have browser actors in xpcshell, and hence can't run automated
|
||||
// tests without this loophole.
|
||||
if (net::UsingNeckoIPCSecurity() &&
|
||||
!AssertAppProcessPermission(Manager()->Manager(), "tcp-socket")) {
|
||||
if (aBrowser && !AssertAppProcessPermission(aBrowser, "tcp-socket")) {
|
||||
FireInteralError(this, __LINE__);
|
||||
return true;
|
||||
}
|
||||
|
@ -47,7 +47,8 @@ public:
|
||||
TCPSocketParent() : mIntermediaryObj(nullptr) {}
|
||||
|
||||
virtual bool RecvOpen(const nsString& aHost, const uint16_t& aPort,
|
||||
const bool& useSSL, const nsString& aBinaryType);
|
||||
const bool& useSSL, const nsString& aBinaryType,
|
||||
PBrowserParent* aBrowser);
|
||||
|
||||
virtual bool RecvSuspend() MOZ_OVERRIDE;
|
||||
virtual bool RecvResume() MOZ_OVERRIDE;
|
||||
|
@ -4,11 +4,13 @@
|
||||
* 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;
|
||||
@ -116,10 +118,22 @@ 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());
|
||||
}
|
||||
if (MissingRequiredTabChild(tabChild, "cookie")) {
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
}
|
||||
}
|
||||
|
||||
// Synchronously call the parent.
|
||||
nsAutoCString result;
|
||||
SendGetCookieString(uriParams, !!isForeign, aFromHttp,
|
||||
IPC::SerializedLoadContext(aChannel), &result);
|
||||
IPC::SerializedLoadContext(aChannel), tabChild, &result);
|
||||
if (!result.IsEmpty())
|
||||
*aCookieString = ToNewCString(result);
|
||||
|
||||
@ -149,9 +163,21 @@ 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());
|
||||
}
|
||||
if (MissingRequiredTabChild(tabChild, "cookie")) {
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
}
|
||||
}
|
||||
|
||||
// Synchronously call the parent.
|
||||
SendSetCookieString(uriParams, !!isForeign, cookieString, serverTime,
|
||||
aFromHttp, IPC::SerializedLoadContext(aChannel));
|
||||
aFromHttp, IPC::SerializedLoadContext(aChannel), tabChild);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "mozilla/net/CookieServiceParent.h"
|
||||
#include "mozilla/dom/PContentParent.h"
|
||||
#include "mozilla/dom/PBrowserParent.h"
|
||||
#include "mozilla/net/NeckoParent.h"
|
||||
|
||||
#include "mozilla/ipc/URIUtils.h"
|
||||
@ -13,25 +13,25 @@
|
||||
#include "nsPrintfCString.h"
|
||||
|
||||
using namespace mozilla::ipc;
|
||||
using mozilla::dom::PContentParent;
|
||||
using mozilla::dom::PBrowserParent;
|
||||
using mozilla::net::NeckoParent;
|
||||
|
||||
namespace mozilla {
|
||||
namespace net {
|
||||
|
||||
MOZ_WARN_UNUSED_RESULT
|
||||
bool
|
||||
CookieServiceParent::GetAppInfoFromParams(const IPC::SerializedLoadContext &aLoadContext,
|
||||
uint32_t& aAppId,
|
||||
bool& aIsInBrowserElement,
|
||||
bool& aIsPrivate)
|
||||
static bool
|
||||
GetAppInfoFromParams(const IPC::SerializedLoadContext &aLoadContext,
|
||||
PBrowserParent* aBrowser,
|
||||
uint32_t& aAppId,
|
||||
bool& aIsInBrowserElement,
|
||||
bool& aIsPrivate)
|
||||
{
|
||||
aAppId = NECKO_NO_APP_ID;
|
||||
aIsInBrowserElement = false;
|
||||
aIsPrivate = false;
|
||||
|
||||
const char* error = NeckoParent::GetValidatedAppInfo(aLoadContext,
|
||||
Manager()->Manager(),
|
||||
const char* error = NeckoParent::GetValidatedAppInfo(aLoadContext, aBrowser,
|
||||
&aAppId,
|
||||
&aIsInBrowserElement);
|
||||
if (error) {
|
||||
@ -69,6 +69,7 @@ CookieServiceParent::RecvGetCookieString(const URIParams& aHost,
|
||||
const bool& aFromHttp,
|
||||
const IPC::SerializedLoadContext&
|
||||
aLoadContext,
|
||||
PBrowserParent* aBrowser,
|
||||
nsCString* aResult)
|
||||
{
|
||||
if (!mCookieService)
|
||||
@ -82,7 +83,7 @@ CookieServiceParent::RecvGetCookieString(const URIParams& aHost,
|
||||
|
||||
uint32_t appId;
|
||||
bool isInBrowserElement, isPrivate;
|
||||
bool valid = GetAppInfoFromParams(aLoadContext, appId,
|
||||
bool valid = GetAppInfoFromParams(aLoadContext, aBrowser, appId,
|
||||
isInBrowserElement, isPrivate);
|
||||
if (!valid) {
|
||||
return false;
|
||||
@ -100,7 +101,8 @@ CookieServiceParent::RecvSetCookieString(const URIParams& aHost,
|
||||
const nsCString& aServerTime,
|
||||
const bool& aFromHttp,
|
||||
const IPC::SerializedLoadContext&
|
||||
aLoadContext)
|
||||
aLoadContext,
|
||||
PBrowserParent* aBrowser)
|
||||
{
|
||||
if (!mCookieService)
|
||||
return true;
|
||||
@ -113,7 +115,7 @@ CookieServiceParent::RecvSetCookieString(const URIParams& aHost,
|
||||
|
||||
uint32_t appId;
|
||||
bool isInBrowserElement, isPrivate;
|
||||
bool valid = GetAppInfoFromParams(aLoadContext, appId,
|
||||
bool valid = GetAppInfoFromParams(aLoadContext, aBrowser, appId,
|
||||
isInBrowserElement, isPrivate);
|
||||
if (!valid) {
|
||||
return false;
|
||||
|
@ -13,6 +13,9 @@ class nsCookieService;
|
||||
class nsIIOService;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
class PBrowserParent;
|
||||
}
|
||||
namespace net {
|
||||
|
||||
class CookieServiceParent : public PCookieServiceParent
|
||||
@ -22,18 +25,13 @@ public:
|
||||
virtual ~CookieServiceParent();
|
||||
|
||||
protected:
|
||||
MOZ_WARN_UNUSED_RESULT bool
|
||||
GetAppInfoFromParams(const IPC::SerializedLoadContext &aLoadContext,
|
||||
uint32_t& aAppId,
|
||||
bool& aIsInBrowserElement,
|
||||
bool& aIsPrivate);
|
||||
|
||||
virtual bool RecvGetCookieString(const URIParams& aHost,
|
||||
virtual bool RecvGetCookieString(const URIParams& aHost,
|
||||
const bool& aIsForeign,
|
||||
const bool& aFromHttp,
|
||||
const IPC::SerializedLoadContext&
|
||||
loadContext,
|
||||
nsCString* aResult) MOZ_OVERRIDE;
|
||||
mozilla::dom::PBrowserParent* aBrowser,
|
||||
nsCString* aResult);
|
||||
|
||||
virtual bool RecvSetCookieString(const URIParams& aHost,
|
||||
const bool& aIsForeign,
|
||||
@ -41,7 +39,8 @@ protected:
|
||||
const nsCString& aServerTime,
|
||||
const bool& aFromHttp,
|
||||
const IPC::SerializedLoadContext&
|
||||
loadContext) MOZ_OVERRIDE;
|
||||
loadContext,
|
||||
mozilla::dom::PBrowserParent* aBrowser);
|
||||
|
||||
nsRefPtr<nsCookieService> mCookieService;
|
||||
};
|
||||
|
@ -6,6 +6,7 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
include protocol PNecko;
|
||||
include protocol PBrowser;
|
||||
include URIParams;
|
||||
|
||||
include "SerializedLoadContext.h";
|
||||
@ -64,7 +65,8 @@ parent:
|
||||
sync GetCookieString(URIParams host,
|
||||
bool isForeign,
|
||||
bool fromHttp,
|
||||
SerializedLoadContext loadContext)
|
||||
SerializedLoadContext loadContext,
|
||||
nullable PBrowser browser)
|
||||
returns (nsCString result);
|
||||
|
||||
/*
|
||||
@ -101,7 +103,8 @@ parent:
|
||||
nsCString cookieString,
|
||||
nsCString serverTime,
|
||||
bool fromHttp,
|
||||
SerializedLoadContext loadContext);
|
||||
SerializedLoadContext loadContext,
|
||||
nullable PBrowser browser);
|
||||
|
||||
__delete__();
|
||||
};
|
||||
|
@ -189,7 +189,7 @@ NeckoChild::DeallocPTCPServerSocketChild(PTCPServerSocketChild* child)
|
||||
}
|
||||
|
||||
PRemoteOpenFileChild*
|
||||
NeckoChild::AllocPRemoteOpenFileChild(const URIParams&)
|
||||
NeckoChild::AllocPRemoteOpenFileChild(const URIParams&, PBrowserChild*)
|
||||
{
|
||||
// We don't allocate here: instead we always use IPDL constructor that takes
|
||||
// an existing RemoteOpenFileChild
|
||||
|
@ -47,7 +47,8 @@ protected:
|
||||
const uint16_t& aBacklog,
|
||||
const nsString& aBinaryType);
|
||||
virtual bool DeallocPTCPServerSocketChild(PTCPServerSocketChild*);
|
||||
virtual PRemoteOpenFileChild* AllocPRemoteOpenFileChild(const URIParams&);
|
||||
virtual PRemoteOpenFileChild* AllocPRemoteOpenFileChild(const URIParams&,
|
||||
PBrowserChild*);
|
||||
virtual bool DeallocPRemoteOpenFileChild(PRemoteOpenFileChild*);
|
||||
};
|
||||
|
||||
|
@ -13,7 +13,6 @@
|
||||
#include "mozilla/net/FTPChannelParent.h"
|
||||
#include "mozilla/net/WebSocketChannelParent.h"
|
||||
#include "mozilla/net/RemoteOpenFileParent.h"
|
||||
#include "mozilla/dom/ContentParent.h"
|
||||
#include "mozilla/dom/TabParent.h"
|
||||
#include "mozilla/dom/network/TCPSocketParent.h"
|
||||
#include "mozilla/dom/network/TCPServerSocketParent.h"
|
||||
@ -26,7 +25,6 @@
|
||||
#include "nsEscape.h"
|
||||
#include "RemoteOpenFileParent.h"
|
||||
|
||||
using mozilla::dom::ContentParent;
|
||||
using mozilla::dom::TabParent;
|
||||
using mozilla::net::PTCPSocketParent;
|
||||
using mozilla::dom::TCPSocketParent;
|
||||
@ -79,80 +77,71 @@ PBOverrideStatusFromLoadContext(const SerializedLoadContext& aSerialized)
|
||||
|
||||
const char*
|
||||
NeckoParent::GetValidatedAppInfo(const SerializedLoadContext& aSerialized,
|
||||
PContentParent* aContent,
|
||||
PBrowserParent* aBrowser,
|
||||
uint32_t* aAppId,
|
||||
bool* aInBrowserElement)
|
||||
{
|
||||
*aAppId = NECKO_UNKNOWN_APP_ID;
|
||||
*aInBrowserElement = false;
|
||||
|
||||
if (UsingNeckoIPCSecurity()) {
|
||||
if (!aBrowser) {
|
||||
return "missing required PBrowser argument";
|
||||
}
|
||||
if (!aSerialized.IsNotNull()) {
|
||||
return "SerializedLoadContext from child is null";
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t appId;
|
||||
bool inBrowserElement;
|
||||
*aAppId = NECKO_UNKNOWN_APP_ID;
|
||||
*aInBrowserElement = false;
|
||||
|
||||
const InfallibleTArray<PBrowserParent*>& browsers = aContent->ManagedPBrowserParent();
|
||||
for (uint32_t i = 0; i < browsers.Length(); i++) {
|
||||
nsRefPtr<TabParent> tabParent = static_cast<TabParent*>(browsers[i]);
|
||||
appId = tabParent->OwnOrContainingAppId();
|
||||
inBrowserElement = aSerialized.IsNotNull() ? aSerialized.mIsInBrowserElement
|
||||
: tabParent->IsBrowserElement();
|
||||
if (aBrowser) {
|
||||
nsRefPtr<TabParent> tabParent = static_cast<TabParent*>(aBrowser);
|
||||
|
||||
if (appId == NECKO_UNKNOWN_APP_ID) {
|
||||
continue;
|
||||
*aAppId = tabParent->OwnOrContainingAppId();
|
||||
*aInBrowserElement = aSerialized.IsNotNull() ? aSerialized.mIsInBrowserElement
|
||||
: 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 (appId == NECKO_NO_APP_ID) {
|
||||
if (*aAppId == NECKO_NO_APP_ID) {
|
||||
if (tabParent->HasOwnApp()) {
|
||||
continue;
|
||||
return "TabParent reports NECKO_NO_APP_ID but also is an app";
|
||||
}
|
||||
if (UsingNeckoIPCSecurity() && 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)
|
||||
continue;
|
||||
return "TabParent reports appId=NECKO_NO_APP_ID but is a mozbrowser";
|
||||
}
|
||||
}
|
||||
*aAppId = appId;
|
||||
*aInBrowserElement = inBrowserElement;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (browsers.Length() != 0) {
|
||||
return "App does not have permission";
|
||||
}
|
||||
|
||||
if (!UsingNeckoIPCSecurity()) {
|
||||
// We are running xpcshell tests
|
||||
if (aSerialized.IsNotNull()) {
|
||||
appId = aSerialized.mAppId;
|
||||
inBrowserElement = aSerialized.mIsInBrowserElement;
|
||||
} else {
|
||||
appId = NECKO_NO_APP_ID;
|
||||
} else {
|
||||
// Only trust appId/inBrowser from child-side loadcontext if we're in
|
||||
// testing mode: allows xpcshell tests to masquerade as apps
|
||||
MOZ_ASSERT(!UsingNeckoIPCSecurity());
|
||||
if (UsingNeckoIPCSecurity()) {
|
||||
return "internal error";
|
||||
}
|
||||
if (aSerialized.IsNotNull()) {
|
||||
*aAppId = aSerialized.mAppId;
|
||||
*aInBrowserElement = aSerialized.mIsInBrowserElement;
|
||||
} else {
|
||||
*aAppId = NECKO_NO_APP_ID;
|
||||
}
|
||||
*aAppId = appId;
|
||||
*aInBrowserElement = inBrowserElement;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return "ContentParent does not have any PBrowsers";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const char *
|
||||
NeckoParent::CreateChannelLoadContext(PBrowserParent* aBrowser,
|
||||
PContentParent* aContent,
|
||||
const SerializedLoadContext& aSerialized,
|
||||
nsCOMPtr<nsILoadContext> &aResult)
|
||||
{
|
||||
uint32_t appId = NECKO_UNKNOWN_APP_ID;
|
||||
bool inBrowser = false;
|
||||
dom::Element* topFrameElement = nullptr;
|
||||
const char* error = GetValidatedAppInfo(aSerialized, aContent, &appId, &inBrowser);
|
||||
const char* error = GetValidatedAppInfo(aSerialized, aBrowser, &appId, &inBrowser);
|
||||
if (error) {
|
||||
return error;
|
||||
}
|
||||
@ -177,8 +166,8 @@ NeckoParent::AllocPHttpChannelParent(PBrowserParent* aBrowser,
|
||||
const HttpChannelCreationArgs& aOpenArgs)
|
||||
{
|
||||
nsCOMPtr<nsILoadContext> loadContext;
|
||||
const char *error = CreateChannelLoadContext(aBrowser, Manager(),
|
||||
aSerialized, loadContext);
|
||||
const char *error = CreateChannelLoadContext(aBrowser, aSerialized,
|
||||
loadContext);
|
||||
if (error) {
|
||||
printf_stderr("NeckoParent::AllocPHttpChannelParent: "
|
||||
"FATAL error: %s: KILLING CHILD PROCESS\n",
|
||||
@ -216,8 +205,8 @@ NeckoParent::AllocPFTPChannelParent(PBrowserParent* aBrowser,
|
||||
const FTPChannelCreationArgs& aOpenArgs)
|
||||
{
|
||||
nsCOMPtr<nsILoadContext> loadContext;
|
||||
const char *error = CreateChannelLoadContext(aBrowser, Manager(),
|
||||
aSerialized, loadContext);
|
||||
const char *error = CreateChannelLoadContext(aBrowser, aSerialized,
|
||||
loadContext);
|
||||
if (error) {
|
||||
printf_stderr("NeckoParent::AllocPFTPChannelParent: "
|
||||
"FATAL error: %s: KILLING CHILD PROCESS\n",
|
||||
@ -283,8 +272,8 @@ NeckoParent::AllocPWebSocketParent(PBrowserParent* browser,
|
||||
const SerializedLoadContext& serialized)
|
||||
{
|
||||
nsCOMPtr<nsILoadContext> loadContext;
|
||||
const char *error = CreateChannelLoadContext(browser, Manager(),
|
||||
serialized, loadContext);
|
||||
const char *error = CreateChannelLoadContext(browser, serialized,
|
||||
loadContext);
|
||||
if (error) {
|
||||
printf_stderr("NeckoParent::AllocPWebSocketParent: "
|
||||
"FATAL error: %s: KILLING CHILD PROCESS\n",
|
||||
@ -353,7 +342,8 @@ NeckoParent::DeallocPTCPServerSocketParent(PTCPServerSocketParent* actor)
|
||||
}
|
||||
|
||||
PRemoteOpenFileParent*
|
||||
NeckoParent::AllocPRemoteOpenFileParent(const URIParams& aURI)
|
||||
NeckoParent::AllocPRemoteOpenFileParent(const URIParams& aURI,
|
||||
PBrowserParent* aBrowser)
|
||||
{
|
||||
nsCOMPtr<nsIURI> uri = DeserializeURI(aURI);
|
||||
nsCOMPtr<nsIFileURL> fileURL = do_QueryInterface(uri);
|
||||
@ -363,37 +353,30 @@ NeckoParent::AllocPRemoteOpenFileParent(const URIParams& aURI)
|
||||
|
||||
// security checks
|
||||
if (UsingNeckoIPCSecurity()) {
|
||||
if (!aBrowser) {
|
||||
printf_stderr("NeckoParent::AllocPRemoteOpenFile: "
|
||||
"FATAL error: missing TabParent: KILLING CHILD PROCESS\n");
|
||||
return nullptr;
|
||||
}
|
||||
nsRefPtr<TabParent> tabParent = static_cast<TabParent*>(aBrowser);
|
||||
uint32_t appId = tabParent->OwnOrContainingAppId();
|
||||
nsCOMPtr<nsIAppsService> appsService =
|
||||
do_GetService(APPS_SERVICE_CONTRACTID);
|
||||
if (!appsService) {
|
||||
return nullptr;
|
||||
}
|
||||
bool haveValidBrowser = false;
|
||||
bool hasManage = false;
|
||||
nsCOMPtr<mozIApplication> mozApp;
|
||||
for (uint32_t i = 0; i < Manager()->ManagedPBrowserParent().Length(); i++) {
|
||||
nsRefPtr<TabParent> tabParent =
|
||||
static_cast<TabParent*>(Manager()->ManagedPBrowserParent()[i]);
|
||||
uint32_t appId = tabParent->OwnOrContainingAppId();
|
||||
nsCOMPtr<mozIDOMApplication> domApp;
|
||||
nsresult rv = appsService->GetAppByLocalId(appId, getter_AddRefs(domApp));
|
||||
if (!domApp) {
|
||||
continue;
|
||||
}
|
||||
mozApp = do_QueryInterface(domApp);
|
||||
if (!mozApp) {
|
||||
continue;
|
||||
}
|
||||
hasManage = false;
|
||||
rv = mozApp->HasPermission("webapps-manage", &hasManage);
|
||||
if (NS_FAILED(rv)) {
|
||||
continue;
|
||||
}
|
||||
haveValidBrowser = true;
|
||||
break;
|
||||
nsCOMPtr<mozIDOMApplication> domApp;
|
||||
nsresult rv = appsService->GetAppByLocalId(appId, getter_AddRefs(domApp));
|
||||
if (!domApp) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!haveValidBrowser) {
|
||||
nsCOMPtr<mozIApplication> mozApp = do_QueryInterface(domApp);
|
||||
if (!mozApp) {
|
||||
return nullptr;
|
||||
}
|
||||
bool hasManage = false;
|
||||
rv = mozApp->HasPermission("webapps-manage", &hasManage);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -436,7 +419,7 @@ NeckoParent::AllocPRemoteOpenFileParent(const URIParams& aURI)
|
||||
} else {
|
||||
// regular packaged apps can only access their own application.zip file
|
||||
nsAutoString basePath;
|
||||
nsresult rv = mozApp->GetBasePath(basePath);
|
||||
rv = mozApp->GetBasePath(basePath);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nullptr;
|
||||
}
|
||||
@ -465,7 +448,8 @@ NeckoParent::AllocPRemoteOpenFileParent(const URIParams& aURI)
|
||||
|
||||
bool
|
||||
NeckoParent::RecvPRemoteOpenFileConstructor(PRemoteOpenFileParent* aActor,
|
||||
const URIParams& aFileURI)
|
||||
const URIParams& aFileURI,
|
||||
PBrowserParent* aBrowser)
|
||||
{
|
||||
return static_cast<RemoteOpenFileParent*>(aActor)->OpenSendCloseDelete();
|
||||
}
|
||||
|
@ -36,24 +36,17 @@ public:
|
||||
uint32_t* aAppId,
|
||||
bool* aInBrowserElement);
|
||||
|
||||
MOZ_WARN_UNUSED_RESULT
|
||||
static const char *
|
||||
GetValidatedAppInfo(const SerializedLoadContext& aSerialized,
|
||||
PContentParent* aBrowser,
|
||||
uint32_t* aAppId,
|
||||
bool* aInBrowserElement);
|
||||
|
||||
/*
|
||||
* Creates LoadContext for parent-side of an e10s channel.
|
||||
*
|
||||
* PContentParent corresponds to the process that is requesting the load.
|
||||
* 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,
|
||||
PContentParent* aContent,
|
||||
const SerializedLoadContext& aSerialized,
|
||||
nsCOMPtr<nsILoadContext> &aResult);
|
||||
|
||||
@ -86,12 +79,14 @@ protected:
|
||||
virtual PWebSocketParent* AllocPWebSocketParent(PBrowserParent* browser,
|
||||
const SerializedLoadContext& aSerialized);
|
||||
virtual bool DeallocPWebSocketParent(PWebSocketParent*);
|
||||
virtual PTCPSocketParent* AllocPTCPSocketParent();
|
||||
virtual PTCPSocketParent* AllocPTCPSocketParent();
|
||||
|
||||
virtual PRemoteOpenFileParent* AllocPRemoteOpenFileParent(const URIParams& aFileURI)
|
||||
virtual PRemoteOpenFileParent* AllocPRemoteOpenFileParent(const URIParams& aFileURI,
|
||||
PBrowserParent* aBrowser)
|
||||
MOZ_OVERRIDE;
|
||||
virtual bool RecvPRemoteOpenFileConstructor(PRemoteOpenFileParent* aActor,
|
||||
const URIParams& aFileURI)
|
||||
const URIParams& aFileURI,
|
||||
PBrowserParent* aBrowser)
|
||||
MOZ_OVERRIDE;
|
||||
virtual bool DeallocPRemoteOpenFileParent(PRemoteOpenFileParent* aActor)
|
||||
MOZ_OVERRIDE;
|
||||
|
@ -54,7 +54,7 @@ parent:
|
||||
|
||||
PWebSocket(PBrowser browser, SerializedLoadContext loadContext);
|
||||
PTCPServerSocket(uint16_t localPort, uint16_t backlog, nsString binaryType);
|
||||
PRemoteOpenFile(URIParams fileuri);
|
||||
PRemoteOpenFile(URIParams fileuri, nullable PBrowser browser);
|
||||
|
||||
HTMLDNSPrefetch(nsString hostname, uint16_t flags);
|
||||
CancelHTMLDNSPrefetch(nsString hostname, uint16_t flags, nsresult reason);
|
||||
|
@ -184,7 +184,7 @@ RemoteOpenFileChild::AsyncRemoteFileOpen(int32_t aFlags,
|
||||
URIParams uri;
|
||||
SerializeURI(mURI, uri);
|
||||
|
||||
gNeckoChild->SendPRemoteOpenFileConstructor(this, uri);
|
||||
gNeckoChild->SendPRemoteOpenFileConstructor(this, uri, mTabChild);
|
||||
|
||||
// The chrome process now has a logical ref to us until it calls Send__delete.
|
||||
AddIPDLReference();
|
||||
|
@ -107,9 +107,7 @@ WyciwygChannelParent::SetupAppData(const IPC::SerializedLoadContext& loadContext
|
||||
if (!mChannel)
|
||||
return true;
|
||||
|
||||
const char* error = NeckoParent::CreateChannelLoadContext(aParent,
|
||||
Manager()->Manager(),
|
||||
loadContext,
|
||||
const char* error = NeckoParent::CreateChannelLoadContext(aParent, loadContext,
|
||||
mLoadContext);
|
||||
if (error) {
|
||||
printf_stderr(nsPrintfCString("WyciwygChannelParent::SetupAppData: FATAL ERROR: %s\n",
|
||||
|
Loading…
Reference in New Issue
Block a user