Skip to content
This repository has been archived by the owner on Aug 4, 2022. It is now read-only.

Commit

Permalink
Backed out changeset 6b886fbb3e48 (bug 1148032) for mochitest-chrome …
Browse files Browse the repository at this point in the history
…orange on b2g emulators
  • Loading branch information
KWierso committed Mar 31, 2015
1 parent af2978d commit 344c2a5
Show file tree
Hide file tree
Showing 17 changed files with 35 additions and 192 deletions.
27 changes: 7 additions & 20 deletions dom/broadcastchannel/BroadcastChannel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,11 @@ class InitializeRunnable final : public WorkerMainThreadRunnable
{
public:
InitializeRunnable(WorkerPrivate* aWorkerPrivate, nsAString& aOrigin,
PrincipalInfo& aPrincipalInfo, bool& aPrivateBrowsing,
ErrorResult& aRv)
PrincipalInfo& aPrincipalInfo, ErrorResult& aRv)
: WorkerMainThreadRunnable(aWorkerPrivate)
, mWorkerPrivate(GetCurrentThreadWorkerPrivate())
, mOrigin(aOrigin)
, mPrincipalInfo(aPrincipalInfo)
, mPrivateBrowsing(aPrivateBrowsing)
, mRv(aRv)
{
MOZ_ASSERT(mWorkerPrivate);
Expand Down Expand Up @@ -182,10 +180,8 @@ class InitializeRunnable final : public WorkerMainThreadRunnable
}

nsIDocument* doc = window->GetExtantDoc();
// No bfcache when BroadcastChannel is used.
if (doc) {
mPrivateBrowsing = nsContentUtils::IsInPrivateBrowsing(doc);

// No bfcache when BroadcastChannel is used.
doc->DisallowBFCaching();
}

Expand All @@ -196,7 +192,6 @@ class InitializeRunnable final : public WorkerMainThreadRunnable
WorkerPrivate* mWorkerPrivate;
nsAString& mOrigin;
PrincipalInfo& mPrincipalInfo;
bool& mPrivateBrowsing;
ErrorResult& mRv;
};

Expand Down Expand Up @@ -401,14 +396,12 @@ BroadcastChannel::IsEnabled(JSContext* aCx, JSObject* aGlobal)
BroadcastChannel::BroadcastChannel(nsPIDOMWindow* aWindow,
const PrincipalInfo& aPrincipalInfo,
const nsAString& aOrigin,
const nsAString& aChannel,
bool aPrivateBrowsing)
const nsAString& aChannel)
: DOMEventTargetHelper(aWindow)
, mWorkerFeature(nullptr)
, mPrincipalInfo(new PrincipalInfo(aPrincipalInfo))
, mOrigin(aOrigin)
, mChannel(aChannel)
, mPrivateBrowsing(aPrivateBrowsing)
, mIsKeptAlive(false)
, mInnerID(0)
, mState(StateActive)
Expand Down Expand Up @@ -438,7 +431,6 @@ BroadcastChannel::Constructor(const GlobalObject& aGlobal,

nsAutoString origin;
PrincipalInfo principalInfo;
bool privateBrowsing = false;
WorkerPrivate* workerPrivate = nullptr;

if (NS_IsMainThread()) {
Expand Down Expand Up @@ -477,10 +469,8 @@ BroadcastChannel::Constructor(const GlobalObject& aGlobal,
}

nsIDocument* doc = window->GetExtantDoc();
// No bfcache when BroadcastChannel is used.
if (doc) {
privateBrowsing = nsContentUtils::IsInPrivateBrowsing(doc);

// No bfcache when BroadcastChannel is used.
doc->DisallowBFCaching();
}
} else {
Expand All @@ -489,8 +479,7 @@ BroadcastChannel::Constructor(const GlobalObject& aGlobal,
MOZ_ASSERT(workerPrivate);

nsRefPtr<InitializeRunnable> runnable =
new InitializeRunnable(workerPrivate, origin, principalInfo,
privateBrowsing, aRv);
new InitializeRunnable(workerPrivate, origin, principalInfo, aRv);
runnable->Dispatch(cx);
}

Expand All @@ -499,8 +488,7 @@ BroadcastChannel::Constructor(const GlobalObject& aGlobal,
}

nsRefPtr<BroadcastChannel> bc =
new BroadcastChannel(window, principalInfo, origin, aChannel,
privateBrowsing);
new BroadcastChannel(window, principalInfo, origin, aChannel);

// Register this component to PBackground.
PBackgroundChild* actor = BackgroundChild::GetForCurrentThread();
Expand Down Expand Up @@ -626,8 +614,7 @@ BroadcastChannel::ActorCreated(PBackgroundChild* aActor)
}

PBroadcastChannelChild* actor =
aActor->SendPBroadcastChannelConstructor(*mPrincipalInfo, mOrigin, mChannel,
mPrivateBrowsing);
aActor->SendPBroadcastChannelConstructor(*mPrincipalInfo, mOrigin, mChannel);

mActor = static_cast<BroadcastChannelChild*>(actor);
MOZ_ASSERT(mActor);
Expand Down
4 changes: 1 addition & 3 deletions dom/broadcastchannel/BroadcastChannel.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,7 @@ class BroadcastChannel final
BroadcastChannel(nsPIDOMWindow* aWindow,
const PrincipalInfo& aPrincipalInfo,
const nsAString& aOrigin,
const nsAString& aChannel,
bool aPrivateBrowsing);
const nsAString& aChannel);

~BroadcastChannel();

Expand All @@ -113,7 +112,6 @@ class BroadcastChannel final

nsString mOrigin;
nsString mChannel;
bool mPrivateBrowsing;

bool mIsKeptAlive;

Expand Down
4 changes: 3 additions & 1 deletion dom/broadcastchannel/BroadcastChannelChild.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ namespace dom {

using namespace workers;

BroadcastChannelChild::BroadcastChannelChild(const nsAString& aOrigin)
BroadcastChannelChild::BroadcastChannelChild(const nsAString& aOrigin,
const nsAString& aChannel)
: mOrigin(aOrigin)
, mChannel(aChannel)
, mActorDestroyed(false)
{
}
Expand Down
5 changes: 4 additions & 1 deletion dom/broadcastchannel/BroadcastChannelChild.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ class BroadcastChannelChild final : public PBroadcastChannelChild
}

private:
explicit BroadcastChannelChild(const nsAString& aOrigin);
BroadcastChannelChild(const nsAString& aOrigin,
const nsAString& aChannel);

~BroadcastChannelChild();

virtual void ActorDestroy(ActorDestroyReason aWhy) override;
Expand All @@ -47,6 +49,7 @@ class BroadcastChannelChild final : public PBroadcastChannelChild
BroadcastChannel* mBC;

nsString mOrigin;
nsString mChannel;

bool mActorDestroyed;
};
Expand Down
13 changes: 4 additions & 9 deletions dom/broadcastchannel/BroadcastChannelParent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,10 @@ namespace dom {

BroadcastChannelParent::BroadcastChannelParent(
const nsAString& aOrigin,
const nsAString& aChannel,
bool aPrivateBrowsing)
const nsAString& aChannel)
: mService(BroadcastChannelService::GetOrCreate())
, mOrigin(aOrigin)
, mChannel(aChannel)
, mPrivateBrowsing(aPrivateBrowsing)
{
AssertIsOnBackgroundThread();
mService->RegisterActor(this);
Expand All @@ -43,7 +41,7 @@ BroadcastChannelParent::RecvPostMessage(const ClonedMessageData& aData)
return false;
}

mService->PostMessage(this, aData, mOrigin, mChannel, mPrivateBrowsing);
mService->PostMessage(this, aData, mOrigin, mChannel);
return true;
}

Expand Down Expand Up @@ -79,14 +77,11 @@ BroadcastChannelParent::ActorDestroy(ActorDestroyReason aWhy)
void
BroadcastChannelParent::CheckAndDeliver(const ClonedMessageData& aData,
const nsString& aOrigin,
const nsString& aChannel,
bool aPrivateBrowsing)
const nsString& aChannel)
{
AssertIsOnBackgroundThread();

if (aOrigin == mOrigin &&
aChannel == mChannel &&
aPrivateBrowsing == mPrivateBrowsing) {
if (aOrigin == mOrigin && aChannel == mChannel) {
// We need to duplicate data only if we have blobs or if the manager of
// them is different than the manager of this parent actor.
if (aData.blobsParent().IsEmpty() ||
Expand Down
7 changes: 2 additions & 5 deletions dom/broadcastchannel/BroadcastChannelParent.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,11 @@ class BroadcastChannelParent final : public PBroadcastChannelParent
public:
void CheckAndDeliver(const ClonedMessageData& aData,
const nsString& aOrigin,
const nsString& aChannel,
bool aPrivateBrowsing);
const nsString& aChannel);

private:
BroadcastChannelParent(const nsAString& aOrigin,
const nsAString& aChannel,
bool aPrivateBrowsing);
const nsAString& aChannel);
~BroadcastChannelParent();

virtual bool
Expand All @@ -43,7 +41,6 @@ class BroadcastChannelParent final : public PBroadcastChannelParent
nsRefPtr<BroadcastChannelService> mService;
nsString mOrigin;
nsString mChannel;
bool mPrivateBrowsing;
};

} // dom namespace
Expand Down
13 changes: 4 additions & 9 deletions dom/broadcastchannel/BroadcastChannelService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,11 @@ struct MOZ_STACK_CLASS PostMessageData final
PostMessageData(BroadcastChannelParent* aParent,
const ClonedMessageData& aData,
const nsAString& aOrigin,
const nsAString& aChannel,
bool aPrivateBrowsing)
const nsAString& aChannel)
: mParent(aParent)
, mData(aData)
, mOrigin(aOrigin)
, mChannel(aChannel)
, mPrivateBrowsing(aPrivateBrowsing)
{
MOZ_ASSERT(aParent);
MOZ_COUNT_CTOR(PostMessageData);
Expand Down Expand Up @@ -118,7 +116,6 @@ struct MOZ_STACK_CLASS PostMessageData final
nsTArray<nsRefPtr<FileImpl>> mFiles;
const nsString mOrigin;
const nsString mChannel;
bool mPrivateBrowsing;
};

PLDHashOperator
Expand All @@ -131,8 +128,7 @@ PostMessageEnumerator(nsPtrHashKey<BroadcastChannelParent>* aKey, void* aPtr)
MOZ_ASSERT(parent);

if (parent != data->mParent) {
parent->CheckAndDeliver(data->mData, data->mOrigin, data->mChannel,
data->mPrivateBrowsing);
parent->CheckAndDeliver(data->mData, data->mOrigin, data->mChannel);
}

return PL_DHASH_NEXT;
Expand All @@ -144,14 +140,13 @@ void
BroadcastChannelService::PostMessage(BroadcastChannelParent* aParent,
const ClonedMessageData& aData,
const nsAString& aOrigin,
const nsAString& aChannel,
bool aPrivateBrowsing)
const nsAString& aChannel)
{
AssertIsOnBackgroundThread();
MOZ_ASSERT(aParent);
MOZ_ASSERT(mAgents.Contains(aParent));

PostMessageData data(aParent, aData, aOrigin, aChannel, aPrivateBrowsing);
PostMessageData data(aParent, aData, aOrigin, aChannel);
mAgents.EnumerateEntries(PostMessageEnumerator, &data);
}

Expand Down
3 changes: 1 addition & 2 deletions dom/broadcastchannel/BroadcastChannelService.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ class BroadcastChannelService final
void PostMessage(BroadcastChannelParent* aParent,
const ClonedMessageData& aData,
const nsAString& aOrigin,
const nsAString& aChannel,
bool aPrivateBrowsing);
const nsAString& aChannel);

private:
BroadcastChannelService();
Expand Down
1 change: 0 additions & 1 deletion dom/broadcastchannel/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ LOCAL_INCLUDES += [
]

MOCHITEST_MANIFESTS += ['tests/mochitest.ini']
MOCHITEST_CHROME_MANIFESTS += ['tests/chrome.ini']

include('/ipc/chromium/chromium-config.mozbuild')

Expand Down
2 changes: 0 additions & 2 deletions dom/broadcastchannel/tests/blank.html

This file was deleted.

5 changes: 0 additions & 5 deletions dom/broadcastchannel/tests/chrome.ini

This file was deleted.

Loading

0 comments on commit 344c2a5

Please sign in to comment.