merge b2g-inbound to mozilla-central

This commit is contained in:
Carsten "Tomcat" Book 2014-03-12 12:23:01 +01:00
commit 091094e1f6
20 changed files with 162 additions and 26 deletions

View File

@ -19,7 +19,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="6c93da506e79bd7641f2cc0958b531ab84ceefe1"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="e61dc0019d9d6135d88ba15153c37f73a952567e"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="353d422fcbd0b41b76e1262f0992a832420a7567"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="d11f524d00cacf5ba0dfbf25e4aa2158b1c3a036"/>

View File

@ -17,7 +17,7 @@
</project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="6c93da506e79bd7641f2cc0958b531ab84ceefe1"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="e61dc0019d9d6135d88ba15153c37f73a952567e"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="353d422fcbd0b41b76e1262f0992a832420a7567"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="cf1dcc0704c0c1845f8a0a0b44838f7e0c0362c9"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="485846b2a40d8ac7d6c1c5f8af6d15b0c10af19d"/>

View File

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="a9e08b91e9cd1f0930f16cfc49ec72f63575d5fe">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="6c93da506e79bd7641f2cc0958b531ab84ceefe1"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="e61dc0019d9d6135d88ba15153c37f73a952567e"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="353d422fcbd0b41b76e1262f0992a832420a7567"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="cf1dcc0704c0c1845f8a0a0b44838f7e0c0362c9"/>

View File

@ -19,7 +19,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="6c93da506e79bd7641f2cc0958b531ab84ceefe1"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="e61dc0019d9d6135d88ba15153c37f73a952567e"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="353d422fcbd0b41b76e1262f0992a832420a7567"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="d11f524d00cacf5ba0dfbf25e4aa2158b1c3a036"/>

View File

@ -4,6 +4,6 @@
"branch": "",
"revision": ""
},
"revision": "82537f452462222ac77bb22f19a6ceb89aeade95",
"revision": "1450b977cb8e074f2e9fe2a12049005204febf72",
"repo_path": "/integration/gaia-central"
}

View File

@ -17,7 +17,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="6c93da506e79bd7641f2cc0958b531ab84ceefe1"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="e61dc0019d9d6135d88ba15153c37f73a952567e"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="353d422fcbd0b41b76e1262f0992a832420a7567"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1f6a1fe07f81c5bc5e1d079c9b60f7f78ca2bf4f"/>

View File

@ -15,7 +15,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="6c93da506e79bd7641f2cc0958b531ab84ceefe1"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="e61dc0019d9d6135d88ba15153c37f73a952567e"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="353d422fcbd0b41b76e1262f0992a832420a7567"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1f6a1fe07f81c5bc5e1d079c9b60f7f78ca2bf4f"/>

View File

@ -19,7 +19,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="6c93da506e79bd7641f2cc0958b531ab84ceefe1"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="e61dc0019d9d6135d88ba15153c37f73a952567e"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="353d422fcbd0b41b76e1262f0992a832420a7567"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1f6a1fe07f81c5bc5e1d079c9b60f7f78ca2bf4f"/>

View File

@ -17,7 +17,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="6c93da506e79bd7641f2cc0958b531ab84ceefe1"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="e61dc0019d9d6135d88ba15153c37f73a952567e"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="353d422fcbd0b41b76e1262f0992a832420a7567"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1f6a1fe07f81c5bc5e1d079c9b60f7f78ca2bf4f"/>

View File

@ -17,7 +17,7 @@
</project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="6c93da506e79bd7641f2cc0958b531ab84ceefe1"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="e61dc0019d9d6135d88ba15153c37f73a952567e"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="353d422fcbd0b41b76e1262f0992a832420a7567"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="cf1dcc0704c0c1845f8a0a0b44838f7e0c0362c9"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="485846b2a40d8ac7d6c1c5f8af6d15b0c10af19d"/>

View File

@ -17,7 +17,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="6c93da506e79bd7641f2cc0958b531ab84ceefe1"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="e61dc0019d9d6135d88ba15153c37f73a952567e"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="353d422fcbd0b41b76e1262f0992a832420a7567"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1f6a1fe07f81c5bc5e1d079c9b60f7f78ca2bf4f"/>

View File

@ -41,7 +41,6 @@ EXPORTS.mozilla += [
UNIFIED_SOURCES += [
'AppProcessChecker.cpp',
'ColorPickerParent.cpp',
'ContentChild.cpp',
'ContentParent.cpp',
'ContentProcess.cpp',
'CrashReporterParent.cpp',
@ -57,10 +56,12 @@ UNIFIED_SOURCES += [
]
# Blob.cpp cannot be compiled in unified mode because it triggers a fatal gcc warning.
# ContentChild.cpp cannot be compiled in unified mode because it forces NSPR logging.
# CrashReporterChild.cpp cannot be compiled in unified mode because of name clashes
# in OS X headers.
SOURCES += [
'Blob.cpp',
'ContentChild.cpp',
'CrashReporterChild.cpp',
]

View File

@ -5,7 +5,10 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "ExternalHelperAppChild.h"
#include "mozilla/net/ChannelDiverterChild.h"
#include "nsIDivertableChannel.h"
#include "nsIInputStream.h"
#include "nsIFTPChannel.h"
#include "nsIRequest.h"
#include "nsIResumableChannel.h"
#include "nsNetUtil.h"
@ -57,30 +60,56 @@ ExternalHelperAppChild::OnDataAvailable(nsIRequest *request,
NS_IMETHODIMP
ExternalHelperAppChild::OnStartRequest(nsIRequest *request, nsISupports *ctx)
{
nsCOMPtr<nsIDivertableChannel> divertable = do_QueryInterface(request);
if (divertable) {
return DivertToParent(divertable, request);
}
nsresult rv = mHandler->OnStartRequest(request, ctx);
NS_ENSURE_SUCCESS(rv, NS_ERROR_UNEXPECTED);
nsCString entityID;
nsCOMPtr<nsIResumableChannel> resumable(do_QueryInterface(request));
if (resumable)
if (resumable) {
resumable->GetEntityID(entityID);
}
SendOnStartRequest(entityID);
return NS_OK;
}
NS_IMETHODIMP
ExternalHelperAppChild::OnStopRequest(nsIRequest *request,
nsISupports *ctx,
nsresult status)
{
nsresult rv = mHandler->OnStopRequest(request, ctx, status);
SendOnStopRequest(status);
// mHandler can be null if we diverted the request to the parent
if (mHandler) {
nsresult rv = mHandler->OnStopRequest(request, ctx, status);
SendOnStopRequest(status);
NS_ENSURE_SUCCESS(rv, NS_ERROR_UNEXPECTED);
}
NS_ENSURE_SUCCESS(rv, NS_ERROR_UNEXPECTED);
return NS_OK;
}
nsresult
ExternalHelperAppChild::DivertToParent(nsIDivertableChannel *divertable, nsIRequest *request)
{
mozilla::net::ChannelDiverterChild *diverter = nullptr;
nsresult rv = divertable->DivertToParent(&diverter);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
MOZ_ASSERT(diverter);
if (SendDivertToParentUsing(diverter)) {
mHandler->DidDivertRequest(request);
mHandler = nullptr;
return NS_OK;
}
return NS_ERROR_FAILURE;
}
bool
ExternalHelperAppChild::RecvCancel(const nsresult& aStatus)

View File

@ -8,8 +8,11 @@
#define mozilla_dom_ExternalHelperAppChild_h
#include "mozilla/dom/PExternalHelperAppChild.h"
#include "nsExternalHelperAppService.h"
#include "nsIStreamListener.h"
class nsIDivertableChannel;
namespace mozilla {
namespace dom {
@ -26,11 +29,13 @@ public:
// Give the listener a real nsExternalAppHandler to complete processing on
// the child.
void SetHandler(nsIStreamListener *handler) { mHandler = handler; }
void SetHandler(nsExternalAppHandler *handler) { mHandler = handler; }
virtual bool RecvCancel(const nsresult& aStatus) MOZ_OVERRIDE;
private:
nsCOMPtr<nsIStreamListener> mHandler;
nsresult DivertToParent(nsIDivertableChannel *divertable, nsIRequest *request);
nsRefPtr<nsExternalAppHandler> mHandler;
nsresult mStatus;
};

View File

@ -18,6 +18,7 @@
#include "mozilla/ipc/URIUtils.h"
#include "nsNetUtil.h"
#include "nsIDocument.h"
#include "mozilla/net/ChannelDiverterParent.h"
#include "mozilla/unused.h"
@ -26,18 +27,21 @@ using namespace mozilla::ipc;
namespace mozilla {
namespace dom {
NS_IMPL_ISUPPORTS_INHERITED4(ExternalHelperAppParent,
NS_IMPL_ISUPPORTS_INHERITED5(ExternalHelperAppParent,
nsHashPropertyBag,
nsIRequest,
nsIChannel,
nsIMultiPartChannel,
nsIResumableChannel)
nsIResumableChannel,
nsIStreamListener)
ExternalHelperAppParent::ExternalHelperAppParent(
const OptionalURIParams& uri,
const int64_t& aContentLength)
: mURI(DeserializeURI(uri))
, mPending(false)
, mDiverted(false)
, mIPCClosed(false)
, mLoadFlags(0)
, mStatus(NS_OK)
, mContentLength(aContentLength)
@ -86,9 +90,25 @@ ExternalHelperAppParent::Init(ContentParent *parent,
aForceSave, getter_AddRefs(mListener));
}
void
ExternalHelperAppParent::ActorDestroy(ActorDestroyReason why)
{
mIPCClosed = true;
}
void
ExternalHelperAppParent::Delete()
{
if (!mIPCClosed) {
unused << Send__delete__(this);
}
}
bool
ExternalHelperAppParent::RecvOnStartRequest(const nsCString& entityID)
{
MOZ_ASSERT(!mDiverted, "child forwarding callbacks after request was diverted");
mEntityID = entityID;
mPending = true;
mStatus = mListener->OnStartRequest(this, nullptr);
@ -103,7 +123,9 @@ ExternalHelperAppParent::RecvOnDataAvailable(const nsCString& data,
if (NS_FAILED(mStatus))
return true;
NS_ASSERTION(mPending, "must be pending!");
MOZ_ASSERT(!mDiverted, "child forwarding callbacks after request was diverted");
MOZ_ASSERT(mPending, "must be pending!");
nsCOMPtr<nsIInputStream> stringStream;
DebugOnly<nsresult> rv = NS_NewByteInputStream(getter_AddRefs(stringStream), data.get(), count, NS_ASSIGNMENT_DEPEND);
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to create dependent string!");
@ -115,13 +137,59 @@ ExternalHelperAppParent::RecvOnDataAvailable(const nsCString& data,
bool
ExternalHelperAppParent::RecvOnStopRequest(const nsresult& code)
{
MOZ_ASSERT(!mDiverted, "child forwarding callbacks after request was diverted");
mPending = false;
mListener->OnStopRequest(this, nullptr,
(NS_SUCCEEDED(code) && NS_FAILED(mStatus)) ? mStatus : code);
unused << Send__delete__(this);
Delete();
return true;
}
bool
ExternalHelperAppParent::RecvDivertToParentUsing(PChannelDiverterParent* diverter)
{
MOZ_ASSERT(diverter);
auto p = static_cast<mozilla::net::ChannelDiverterParent*>(diverter);
p->DivertTo(this);
mDiverted = true;
unused << p->Send__delete__(p);
return true;
}
//
// nsIStreamListener
//
NS_IMETHODIMP
ExternalHelperAppParent::OnDataAvailable(nsIRequest *request,
nsISupports *ctx,
nsIInputStream *input,
uint64_t offset,
uint32_t count)
{
MOZ_ASSERT(mDiverted);
return mListener->OnDataAvailable(request, ctx, input, offset, count);
}
NS_IMETHODIMP
ExternalHelperAppParent::OnStartRequest(nsIRequest *request, nsISupports *ctx)
{
MOZ_ASSERT(mDiverted);
return mListener->OnStartRequest(request, ctx);
}
NS_IMETHODIMP
ExternalHelperAppParent::OnStopRequest(nsIRequest *request,
nsISupports *ctx,
nsresult status)
{
MOZ_ASSERT(mDiverted);
nsresult rv = mListener->OnStopRequest(request, ctx, status);
Delete();
return rv;
}
ExternalHelperAppParent::~ExternalHelperAppParent()
{
}

View File

@ -8,6 +8,7 @@
#include "nsIChannel.h"
#include "nsIMultiPartChannel.h"
#include "nsIResumableChannel.h"
#include "nsIStreamListener.h"
#include "nsHashPropertyBag.h"
namespace IPC {
@ -20,6 +21,10 @@ namespace ipc {
class OptionalURIParams;
} // namespace ipc
namespace net {
class PChannelDiverterParent;
} // namespace net
namespace dom {
class ContentParent;
@ -30,6 +35,7 @@ class ExternalHelperAppParent : public PExternalHelperAppParent
, public nsIChannel
, public nsIMultiPartChannel
, public nsIResumableChannel
, public nsIStreamListener
{
typedef mozilla::ipc::OptionalURIParams OptionalURIParams;
@ -39,6 +45,8 @@ public:
NS_DECL_NSICHANNEL
NS_DECL_NSIMULTIPARTCHANNEL
NS_DECL_NSIRESUMABLECHANNEL
NS_DECL_NSISTREAMLISTENER
NS_DECL_NSIREQUESTOBSERVER
bool RecvOnStartRequest(const nsCString& entityID) MOZ_OVERRIDE;
bool RecvOnDataAvailable(const nsCString& data,
@ -46,6 +54,8 @@ public:
const uint32_t& count) MOZ_OVERRIDE;
bool RecvOnStopRequest(const nsresult& code) MOZ_OVERRIDE;
bool RecvDivertToParentUsing(PChannelDiverterParent* diverter) MOZ_OVERRIDE;
ExternalHelperAppParent(const OptionalURIParams& uri, const int64_t& contentLength);
void Init(ContentParent *parent,
const nsCString& aMimeContentType,
@ -57,10 +67,16 @@ public:
PBrowserParent* aBrowser);
virtual ~ExternalHelperAppParent();
protected:
virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE;
void Delete();
private:
nsCOMPtr<nsIStreamListener> mListener;
nsCOMPtr<nsIURI> mURI;
bool mPending;
DebugOnly<bool> mDiverted;
bool mIPCClosed;
nsLoadFlags mLoadFlags;
nsresult mStatus;
int64_t mContentLength;

View File

@ -3,6 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
include protocol PContent;
include protocol PChannelDiverter;
namespace mozilla {
namespace dom {
@ -16,6 +17,8 @@ parent:
OnDataAvailable(nsCString data, uint64_t offset, uint32_t count);
OnStopRequest(nsresult code);
DivertToParentUsing(PChannelDiverter diverter);
child:
Cancel(nsresult aStatus);
__delete__();

View File

@ -56,7 +56,6 @@ EXPORTS.mozilla.dom += [
]
UNIFIED_SOURCES += [
'ExternalHelperAppChild.cpp',
'ExternalHelperAppParent.cpp',
'nsLocalHandlerApp.cpp',
'nsMIMEInfoImpl.cpp',
@ -64,6 +63,7 @@ UNIFIED_SOURCES += [
# These files can't be built in unified mode because they force NSPR logging.
SOURCES += [
'ExternalHelperAppChild.cpp',
'nsExternalHelperAppService.cpp',
'nsExternalProtocolHandler.cpp',
]

View File

@ -1202,10 +1202,10 @@ NS_INTERFACE_MAP_BEGIN(nsExternalAppHandler)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIStreamListener)
NS_INTERFACE_MAP_ENTRY(nsIStreamListener)
NS_INTERFACE_MAP_ENTRY(nsIRequestObserver)
NS_INTERFACE_MAP_ENTRY(nsIHelperAppLauncher)
NS_INTERFACE_MAP_ENTRY(nsIHelperAppLauncher)
NS_INTERFACE_MAP_ENTRY(nsICancelable)
NS_INTERFACE_MAP_ENTRY(nsITimerCallback)
NS_INTERFACE_MAP_ENTRY(nsIBackgroundFileSaverObserver)
NS_INTERFACE_MAP_ENTRY(nsIBackgroundFileSaverObserver)
NS_INTERFACE_MAP_END_THREADSAFE
nsExternalAppHandler::nsExternalAppHandler(nsIMIMEInfo * aMIMEInfo,
@ -1271,6 +1271,15 @@ nsExternalAppHandler::~nsExternalAppHandler()
MOZ_ASSERT(!mSaver, "Saver should hold a reference to us until deleted");
}
void
nsExternalAppHandler::DidDivertRequest(nsIRequest *request)
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Content, "in child process");
// Remove our request from the child loadGroup
RetargetLoadNotifications(request);
MaybeCloseWindow();
}
NS_IMETHODIMP nsExternalAppHandler::SetWebProgressListener(nsIWebProgressListener2 * aWebProgressListener)
{
// This is always called by nsHelperDlg.js. Go ahead and register the

View File

@ -237,6 +237,11 @@ public:
~nsExternalAppHandler();
/**
* Clean up after the request was diverted to the parent process.
*/
void DidDivertRequest(nsIRequest *request);
protected:
nsCOMPtr<nsIFile> mTempFile;
nsCOMPtr<nsIURI> mSourceUrl;