merge mozilla-central to autoland. r=merge a=merge

This commit is contained in:
Sebastian Hengst 2017-10-24 23:59:14 +02:00
commit 24b7b2eb7c
744 changed files with 8719 additions and 6211 deletions

View File

@ -22,4 +22,4 @@
# changes to stick? As of bug 928195, this shouldn't be necessary! Please
# don't change CLOBBER for WebIDL changes any more.
Merge day clobber
Bug 1409329 works better after a clobber.

View File

@ -3,10 +3,27 @@
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="bug 471493 'crash [@ nsPropertyTable::GetPropertyInternal]'"
onload="doTest();">
onload="doTest();" class="reftest-wait">
<script type="application/javascript">
<![CDATA[
function addA11yLoadEvent(accService, func) {
function waitForDocLoad() {
setTimeout(() => {
let accDoc = accService.getAccessibleFor(document);
let state = {};
accDoc.getState(state, {});
if (state.value & SpecialPowers.Ci.nsIAccessibleStates.STATE_BUSY) {
return waitForDocLoad();
}
setTimeout(func, 0);
}, 0);
}
waitForDocLoad();
}
function doTest()
{
var accService = SpecialPowers.Cc["@mozilla.org/accessibilityService;1"].
@ -17,8 +34,11 @@
var y = treecol.boxObject.screenY;
var tree = document.getElementById("tree");
var treeAcc = accService.getAccessibleFor(tree);
treeAcc.getChildAtPoint(x + 1, y + 1);
addA11yLoadEvent(accService, () => {
var treeAcc = accService.getAccessibleFor(tree);
treeAcc.getChildAtPoint(x + 1, y + 1);
document.documentElement.removeAttribute("class");
});
}
]]>
</script>

View File

@ -1,3 +1,5 @@
# Disabled because they cause assertions/crashes in later crashtests, see bug 918246
skip load 448064.xhtml
skip load 471493.xul
load 448064.xhtml # This test instantiates a11y, so be careful about adding tests before it
load 471493.xul
# last_test_to_unload_testsuite.xul MUST be the last test in the list because it
# is responsible for shutting down accessibility service affecting later tests.
load last_test_to_unload_testsuite.xul

View File

@ -0,0 +1,36 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="bug 471493 'crash [@ nsPropertyTable::GetPropertyInternal]'"
onload="shutdown();" class="reftest-wait">
<script type="application/javascript">
<![CDATA[
function shutdown() {
!SpecialPowers.Services.appinfo.accessibilityEnabled &&
dump("### Error : Accessibility is expected to be enabled.\n");
// Force garbage collection. We try really hard to garbage collect
// everythin here to ensure that all a11y xpcom bits are shut down and
// avoid intermittent timeouts.
SpecialPowers.gc();
SpecialPowers.forceShrinkingGC();
SpecialPowers.forceCC();
SpecialPowers.gc();
SpecialPowers.forceShrinkingGC();
SpecialPowers.forceCC();
if (SpecialPowers.Services.appinfo.accessibilityEnabled) {
let observe = (subject, topic, data) => {
SpecialPowers.Services.obs.removeObserver(observe, "a11y-init-or-shutdown");
data === "0" && document.documentElement.removeAttribute("class");
};
SpecialPowers.Services.obs.addObserver(observe, "a11y-init-or-shutdown");
} else {
document.documentElement.removeAttribute("class");
}
}
]]>
</script>
</window>

View File

@ -57,8 +57,8 @@ var consoleOpened = Task.async(function* (hud) {
// 4 values, and the following properties:
// __defineGetter__ __defineSetter__ __lookupGetter__ __lookupSetter__
// __proto__ hasOwnProperty isPrototypeOf propertyIsEnumerable
// toLocaleString toString toSource unwatch valueOf watch constructor.
is(popup.itemCount, 19, "popup.itemCount is correct");
// toLocaleString toString toSource valueOfconstructor.
is(popup.itemCount, 17, "popup.itemCount is correct");
let sameItems = popup.getItems().reverse().map(function (e) {
return e.label;
@ -82,36 +82,34 @@ var consoleOpened = Task.async(function* (hud) {
"toLocaleString",
"toSource",
"toString",
"unwatch",
"valueOf",
"watch",
][index] === prop;
}), "getItems returns the items we expect");
is(popup.selectedIndex, 18,
is(popup.selectedIndex, 16,
"Index of the first item from bottom is selected.");
EventUtils.synthesizeKey("VK_DOWN", {});
let prefix = jsterm.getInputValue().replace(/[\S]/g, " ");
is(popup.selectedIndex, 0, "index 0 is selected");
is(popup.selectedItem.label, "watch", "watch is selected");
is(completeNode.value, prefix + "watch",
"completeNode.value holds watch");
EventUtils.synthesizeKey("VK_DOWN", {});
is(popup.selectedIndex, 1, "index 1 is selected");
is(popup.selectedItem.label, "valueOf", "valueOf is selected");
is(completeNode.value, prefix + "valueOf",
"completeNode.value holds valueOf");
EventUtils.synthesizeKey("VK_DOWN", {});
is(popup.selectedIndex, 1, "index 1 is selected");
is(popup.selectedItem.label, "toString", "toString is selected");
is(completeNode.value, prefix + "toString",
"completeNode.value holds toString");
EventUtils.synthesizeKey("VK_UP", {});
is(popup.selectedIndex, 0, "index 0 is selected");
is(popup.selectedItem.label, "watch", "watch is selected");
is(completeNode.value, prefix + "watch",
"completeNode.value holds watch");
is(popup.selectedItem.label, "valueOf", "valueOf is selected");
is(completeNode.value, prefix + "valueOf",
"completeNode.value holds valueOf");
let currentSelectionIndex = popup.selectedIndex;
@ -127,7 +125,7 @@ var consoleOpened = Task.async(function* (hud) {
"Index is less after Page UP");
EventUtils.synthesizeKey("VK_END", {});
is(popup.selectedIndex, 18, "index is last after End");
is(popup.selectedIndex, 16, "index is last after End");
EventUtils.synthesizeKey("VK_HOME", {});
is(popup.selectedIndex, 0, "index is first after Home");
@ -151,7 +149,7 @@ function popupHideAfterTab() {
// At this point the completion suggestion should be accepted.
ok(!popup.isOpen, "popup is not open");
is(jsterm.getInputValue(), "window.foobarBug585991.watch",
is(jsterm.getInputValue(), "window.foobarBug585991.valueOf",
"completion was successful after VK_TAB");
ok(!completeNode.value, "completeNode is empty");
@ -159,17 +157,17 @@ function popupHideAfterTab() {
popup.once("popup-opened", function onShown() {
ok(popup.isOpen, "popup is open");
is(popup.itemCount, 19, "popup.itemCount is correct");
is(popup.itemCount, 17, "popup.itemCount is correct");
is(popup.selectedIndex, 18, "First index from bottom is selected");
is(popup.selectedIndex, 16, "First index from bottom is selected");
EventUtils.synthesizeKey("VK_DOWN", {});
let prefix = jsterm.getInputValue().replace(/[\S]/g, " ");
is(popup.selectedIndex, 0, "index 0 is selected");
is(popup.selectedItem.label, "watch", "watch is selected");
is(completeNode.value, prefix + "watch",
"completeNode.value holds watch");
is(popup.selectedItem.label, "valueOf", "valueOf is selected");
is(completeNode.value, prefix + "valueOf",
"completeNode.value holds valueOf");
popup.once("popup-closed", function onHidden() {
ok(!popup.isOpen, "popup is not open after VK_ESCAPE");
@ -203,29 +201,29 @@ function testReturnKey() {
popup.once("popup-opened", function onShown() {
ok(popup.isOpen, "popup is open");
is(popup.itemCount, 19, "popup.itemCount is correct");
is(popup.itemCount, 17, "popup.itemCount is correct");
is(popup.selectedIndex, 18, "First index from bottom is selected");
is(popup.selectedIndex, 16, "First index from bottom is selected");
EventUtils.synthesizeKey("VK_DOWN", {});
let prefix = jsterm.getInputValue().replace(/[\S]/g, " ");
is(popup.selectedIndex, 0, "index 0 is selected");
is(popup.selectedItem.label, "watch", "watch is selected");
is(completeNode.value, prefix + "watch",
"completeNode.value holds watch");
is(popup.selectedItem.label, "valueOf", "valueOf is selected");
is(completeNode.value, prefix + "valueOf",
"completeNode.value holds valueOf");
EventUtils.synthesizeKey("VK_DOWN", {});
is(popup.selectedIndex, 1, "index 1 is selected");
is(popup.selectedItem.label, "valueOf", "valueOf is selected");
is(completeNode.value, prefix + "valueOf",
"completeNode.value holds valueOf");
is(popup.selectedItem.label, "toString", "toString is selected");
is(completeNode.value, prefix + "toString",
"completeNode.value holds toString");
popup.once("popup-closed", function onHidden() {
ok(!popup.isOpen, "popup is not open after VK_RETURN");
is(jsterm.getInputValue(), "window.foobarBug585991.valueOf",
is(jsterm.getInputValue(), "window.foobarBug585991.toString",
"completion was successful after VK_RETURN");
ok(!completeNode.value, "completeNode is empty");

View File

@ -30,7 +30,6 @@
#include "nsAutoPtr.h"
#include "nsAtom.h"
#include "nsIFile.h"
#include "nsIIPCBackgroundChildCreateCallback.h"
#include "nsIPrincipal.h"
#include "nsIRunnable.h"
#include "nsISimpleEnumerator.h"
@ -1062,7 +1061,6 @@ namespace {
class ChildRunnable final
: public FileDescriptorHolder
, public PAsmJSCacheEntryChild
, public nsIIPCBackgroundChildCreateCallback
{
typedef mozilla::ipc::PBackgroundChild PBackgroundChild;
@ -1105,9 +1103,7 @@ public:
}
};
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIRUNNABLE
NS_DECL_NSIIPCBACKGROUNDCHILDCREATECALLBACK
ChildRunnable(nsIPrincipal* aPrincipal,
OpenMode aOpenMode,
@ -1321,18 +1317,25 @@ ChildRunnable::Run()
mPrincipalInfo = Move(principalInfo);
PBackgroundChild* actor = BackgroundChild::GetForCurrentThread();
if (actor) {
ActorCreated(actor);
return NS_OK;
}
if (NS_WARN_IF(!BackgroundChild::GetOrCreateForCurrentThread(this))) {
PBackgroundChild* actor = BackgroundChild::GetOrCreateForCurrentThread();
if (NS_WARN_IF(!actor)) {
Fail(JS::AsmJSCache_InternalError);
return NS_OK;
}
mState = eBackgroundChildPending;
if (!actor->SendPAsmJSCacheEntryConstructor(this, mOpenMode, mWriteParams,
*mPrincipalInfo)) {
// Unblock the parsing thread with a failure.
Fail(JS::AsmJSCache_InternalError);
return NS_OK;
}
// AddRef to keep this runnable alive until IPDL deallocates the
// subprotocol (DeallocEntryChild).
AddRef();
mState = eOpening;
return NS_OK;
}
@ -1372,40 +1375,6 @@ ChildRunnable::Run()
return NS_OK;
}
void
ChildRunnable::ActorCreated(PBackgroundChild* aActor)
{
MOZ_ASSERT(NS_IsMainThread());
if (!aActor->SendPAsmJSCacheEntryConstructor(this, mOpenMode, mWriteParams,
*mPrincipalInfo)) {
// Unblock the parsing thread with a failure.
Fail(JS::AsmJSCache_InternalError);
return;
}
// AddRef to keep this runnable alive until IPDL deallocates the
// subprotocol (DeallocEntryChild).
AddRef();
mState = eOpening;
}
void
ChildRunnable::ActorFailed()
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(mState == eBackgroundChildPending);
Fail(JS::AsmJSCache_InternalError);
}
NS_IMPL_ISUPPORTS_INHERITED(ChildRunnable,
FileDescriptorHolder,
nsIIPCBackgroundChildCreateCallback)
} // unnamed namespace
void

View File

@ -51,6 +51,8 @@ namespace dom {
using namespace workers;
static LazyLogModule gEventSourceLog("EventSource");
#define SPACE_CHAR (char16_t)0x0020
#define CR_CHAR (char16_t)0x000D
#define LF_CHAR (char16_t)0x000A
@ -953,8 +955,7 @@ EventSourceImpl::SetupHttpChannel()
{
AssertIsOnMainThread();
MOZ_ASSERT(!IsShutDown());
DebugOnly<nsresult> rv =
mHttpChannel->SetRequestMethod(NS_LITERAL_CSTRING("GET"));
nsresult rv = mHttpChannel->SetRequestMethod(NS_LITERAL_CSTRING("GET"));
MOZ_ASSERT(NS_SUCCEEDED(rv));
/* set the http request headers */
@ -965,11 +966,19 @@ EventSourceImpl::SetupHttpChannel()
// LOAD_BYPASS_CACHE already adds the Cache-Control: no-cache header
if (!mLastEventID.IsEmpty()) {
rv = mHttpChannel->SetRequestHeader(NS_LITERAL_CSTRING("Last-Event-ID"),
NS_ConvertUTF16toUTF8(mLastEventID), false);
MOZ_ASSERT(NS_SUCCEEDED(rv));
if (mLastEventID.IsEmpty()) {
return;
}
NS_ConvertUTF16toUTF8 eventId(mLastEventID);
rv = mHttpChannel->SetRequestHeader(NS_LITERAL_CSTRING("Last-Event-ID"),
eventId, false);
#ifdef DEBUG
if (NS_FAILED(rv)) {
MOZ_LOG(gEventSourceLog, LogLevel::Warning,
("SetupHttpChannel. rv=%x (%s)", uint32_t(rv), eventId.get()));
}
#endif
Unused << rv;
}
nsresult
@ -1725,7 +1734,8 @@ EventSourceImpl::ParseCharacter(char16_t aChr)
NS_ENSURE_SUCCESS(rv, rv);
mStatus = PARSE_STATE_BEGIN_OF_LINE;
} else {
} else if (aChr != 0) {
// Avoid appending the null char to the field value.
mLastFieldValue += aChr;
}
@ -1744,7 +1754,8 @@ EventSourceImpl::ParseCharacter(char16_t aChr)
mStatus = PARSE_STATE_BEGIN_OF_LINE;
} else if (aChr == COLON_CHAR) {
mStatus = PARSE_STATE_COMMENT;
} else {
} else if (aChr != 0) {
// Avoid appending the null char to the field name.
mLastFieldName += aChr;
mStatus = PARSE_STATE_FIELD_NAME;
}

View File

@ -1125,11 +1125,6 @@ public:
return false;
}
bool watch(JSContext *cx, JS::Handle<JSObject*> proxy,
JS::Handle<jsid> id, JS::Handle<JSObject*> callable) const override;
bool unwatch(JSContext *cx, JS::Handle<JSObject*> proxy,
JS::Handle<jsid> id) const override;
static const nsOuterWindowProxy singleton;
protected:
@ -1478,20 +1473,6 @@ nsOuterWindowProxy::AppendIndexedPropertyNames(JSContext *cx, JSObject *proxy,
return true;
}
bool
nsOuterWindowProxy::watch(JSContext *cx, JS::Handle<JSObject*> proxy,
JS::Handle<jsid> id, JS::Handle<JSObject*> callable) const
{
return js::WatchGuts(cx, proxy, id, callable);
}
bool
nsOuterWindowProxy::unwatch(JSContext *cx, JS::Handle<JSObject*> proxy,
JS::Handle<jsid> id) const
{
return js::UnwatchGuts(cx, proxy, id);
}
size_t
nsOuterWindowProxy::objectMoved(JSObject *obj, JSObject *old) const
{

View File

@ -2067,8 +2067,6 @@ const js::ObjectOps sInterfaceObjectClassObjectOps = {
nullptr, /* setProperty */
nullptr, /* getOwnPropertyDescriptor */
nullptr, /* deleteProperty */
nullptr, /* watch */
nullptr, /* unwatch */
nullptr, /* getElements */
InterfaceObjectToString, /* funToString */
};

View File

@ -13556,9 +13556,9 @@ class CGDictionary(CGThing):
# continues to match the list in test_Object.prototype_props.html
if (member.identifier.name in
["constructor", "toSource", "toString", "toLocaleString", "valueOf",
"watch", "unwatch", "hasOwnProperty", "isPrototypeOf",
"propertyIsEnumerable", "__defineGetter__", "__defineSetter__",
"__lookupGetter__", "__lookupSetter__", "__proto__"]):
"hasOwnProperty", "isPrototypeOf", "propertyIsEnumerable",
"__defineGetter__", "__defineSetter__", "__lookupGetter__",
"__lookupSetter__", "__proto__"]):
raise TypeError("'%s' member of %s dictionary shadows "
"a property of Object.prototype, and Xrays to "
"Object can't handle that.\n"

View File

@ -233,19 +233,6 @@ DOMProxyHandler::delete_(JSContext* cx, JS::Handle<JSObject*> proxy,
return result.succeed();
}
bool
BaseDOMProxyHandler::watch(JSContext* cx, JS::Handle<JSObject*> proxy, JS::Handle<jsid> id,
JS::Handle<JSObject*> callable) const
{
return js::WatchGuts(cx, proxy, id, callable);
}
bool
BaseDOMProxyHandler::unwatch(JSContext* cx, JS::Handle<JSObject*> proxy, JS::Handle<jsid> id) const
{
return js::UnwatchGuts(cx, proxy, id);
}
bool
BaseDOMProxyHandler::ownPropertyKeys(JSContext* cx,
JS::Handle<JSObject*> proxy,

View File

@ -66,11 +66,6 @@ public:
virtual bool getOwnEnumerablePropertyKeys(JSContext* cx, JS::Handle<JSObject*> proxy,
JS::AutoIdVector &props) const override;
bool watch(JSContext* cx, JS::Handle<JSObject*> proxy, JS::Handle<jsid> id,
JS::Handle<JSObject*> callable) const override;
bool unwatch(JSContext* cx, JS::Handle<JSObject*> proxy,
JS::Handle<jsid> id) const override;
protected:
// Hook for subclasses to implement shared ownPropertyKeys()/keys()
// functionality. The "flags" argument is either JSITER_OWNONLY (for keys())

View File

@ -11,9 +11,9 @@ test(function() {
// Codegen.py's CGDictionary.getMemberDefinition method.
var expected = [
"constructor", "toSource", "toString", "toLocaleString", "valueOf",
"watch", "unwatch", "hasOwnProperty", "isPrototypeOf",
"propertyIsEnumerable", "__defineGetter__", "__defineSetter__",
"__lookupGetter__", "__lookupSetter__", "__proto__"
"hasOwnProperty", "isPrototypeOf", "propertyIsEnumerable",
"__defineGetter__", "__defineSetter__", "__lookupGetter__",
"__lookupSetter__", "__proto__"
];
assert_array_equals(props.sort(), expected.sort());
}, "Own properties of Object.prototype");

View File

@ -269,8 +269,6 @@ BroadcastChannel::BroadcastChannel(nsPIDOMWindowInner* aWindow,
const nsAString& aChannel)
: DOMEventTargetHelper(aWindow)
, mWorkerHolder(nullptr)
, mPrincipalInfo(new PrincipalInfo(aPrincipalInfo))
, mOrigin(aOrigin)
, mChannel(aChannel)
, mInnerID(0)
, mState(StateActive)
@ -346,13 +344,20 @@ BroadcastChannel::Constructor(const GlobalObject& aGlobal,
new BroadcastChannel(window, principalInfo, origin, aChannel);
// Register this component to PBackground.
PBackgroundChild* actor = BackgroundChild::GetForCurrentThread();
if (actor) {
bc->ActorCreated(actor);
} else {
BackgroundChild::GetOrCreateForCurrentThread(bc);
PBackgroundChild* actorChild = BackgroundChild::GetOrCreateForCurrentThread();
if (NS_WARN_IF(!actorChild)) {
MOZ_CRASH("Failed to create a PBackgroundChild actor!");
}
PBroadcastChannelChild* actor =
actorChild->SendPBroadcastChannelConstructor(principalInfo, origin,
nsString(aChannel));
bc->mActor = static_cast<BroadcastChannelChild*>(actor);
MOZ_ASSERT(bc->mActor);
bc->mActor->SetParent(bc);
if (!workerPrivate) {
MOZ_ASSERT(window);
MOZ_ASSERT(window->IsInnerWindow());
@ -407,18 +412,12 @@ BroadcastChannel::PostMessageData(BroadcastChannelMessage* aData)
{
RemoveDocFromBFCache();
if (mActor) {
RefPtr<BCPostMessageRunnable> runnable =
new BCPostMessageRunnable(mActor, aData);
RefPtr<BCPostMessageRunnable> runnable =
new BCPostMessageRunnable(mActor, aData);
if (NS_FAILED(NS_DispatchToCurrentThread(runnable))) {
NS_WARNING("Failed to dispatch to the current thread!");
}
return;
if (NS_FAILED(NS_DispatchToCurrentThread(runnable))) {
NS_WARNING("Failed to dispatch to the current thread!");
}
mPendingMessages.AppendElement(aData);
}
void
@ -428,55 +427,15 @@ BroadcastChannel::Close()
return;
}
if (mPendingMessages.IsEmpty()) {
// We cannot call Shutdown() immediatelly because we could have some
// postMessage runnable already dispatched. Instead, we change the state to
// StateClosed and we shutdown the actor asynchrounsly.
// We cannot call Shutdown() immediatelly because we could have some
// postMessage runnable already dispatched. Instead, we change the state to
// StateClosed and we shutdown the actor asynchrounsly.
mState = StateClosed;
RefPtr<CloseRunnable> runnable = new CloseRunnable(this);
mState = StateClosed;
RefPtr<CloseRunnable> runnable = new CloseRunnable(this);
if (NS_FAILED(NS_DispatchToCurrentThread(runnable))) {
NS_WARNING("Failed to dispatch to the current thread!");
}
} else {
MOZ_ASSERT(!mActor);
mState = StateClosing;
}
}
void
BroadcastChannel::ActorFailed()
{
MOZ_CRASH("Failed to create a PBackgroundChild actor!");
}
void
BroadcastChannel::ActorCreated(PBackgroundChild* aActor)
{
MOZ_ASSERT(aActor);
if (mState == StateClosed) {
return;
}
PBroadcastChannelChild* actor =
aActor->SendPBroadcastChannelConstructor(*mPrincipalInfo, mOrigin, mChannel);
mActor = static_cast<BroadcastChannelChild*>(actor);
MOZ_ASSERT(mActor);
mActor->SetParent(this);
// Flush pending messages.
for (uint32_t i = 0; i < mPendingMessages.Length(); ++i) {
PostMessageData(mPendingMessages[i]);
}
mPendingMessages.Clear();
if (mState == StateClosing) {
Shutdown();
if (NS_FAILED(NS_DispatchToCurrentThread(runnable))) {
NS_WARNING("Failed to dispatch to the current thread!");
}
}
@ -565,7 +524,6 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(BroadcastChannel,
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(BroadcastChannel)
NS_INTERFACE_MAP_ENTRY(nsIIPCBackgroundChildCreateCallback)
NS_INTERFACE_MAP_ENTRY(nsIObserver)
NS_INTERFACE_MAP_END_INHERITING(DOMEventTargetHelper)

View File

@ -10,7 +10,6 @@
#include "mozilla/Attributes.h"
#include "mozilla/DOMEventTargetHelper.h"
#include "nsAutoPtr.h"
#include "nsIIPCBackgroundChildCreateCallback.h"
#include "nsIObserver.h"
#include "nsTArray.h"
#include "mozilla/RefPtr.h"
@ -34,12 +33,10 @@ class BroadcastChannelMessage;
class BroadcastChannel final
: public DOMEventTargetHelper
, public nsIIPCBackgroundChildCreateCallback
, public nsIObserver
{
friend class BroadcastChannelChild;
NS_DECL_NSIIPCBACKGROUNDCHILDCREATECALLBACK
NS_DECL_NSIOBSERVER
typedef mozilla::ipc::PrincipalInfo PrincipalInfo;
@ -88,20 +85,15 @@ private:
void RemoveDocFromBFCache();
RefPtr<BroadcastChannelChild> mActor;
nsTArray<RefPtr<BroadcastChannelMessage>> mPendingMessages;
nsAutoPtr<workers::WorkerHolder> mWorkerHolder;
nsAutoPtr<PrincipalInfo> mPrincipalInfo;
nsCString mOrigin;
nsString mChannel;
uint64_t mInnerID;
enum {
StateActive,
StateClosing,
StateClosed
} mState;
};

View File

@ -50,11 +50,10 @@ NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(mozilla::dom::cache::CacheStorage,
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(CacheStorage)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_ENTRY(nsIIPCBackgroundChildCreateCallback)
NS_INTERFACE_MAP_END
// We cannot reference IPC types in a webidl binding implementation header. So
// define this in the .cpp and use heap storage in the mPendingRequests list.
// define this in the .cpp.
struct CacheStorage::Entry final
{
RefPtr<Promise> mPromise;
@ -275,7 +274,6 @@ CacheStorage::CacheStorage(Namespace aNamespace, nsIGlobalObject* aGlobal,
: mNamespace(aNamespace)
, mGlobal(aGlobal)
, mPrincipalInfo(MakeUnique<PrincipalInfo>(aPrincipalInfo))
, mWorkerHolder(aWorkerHolder)
, mActor(nullptr)
, mStatus(NS_OK)
{
@ -283,19 +281,26 @@ CacheStorage::CacheStorage(Namespace aNamespace, nsIGlobalObject* aGlobal,
// If the PBackground actor is already initialized then we can
// immediately use it
PBackgroundChild* actor = BackgroundChild::GetForCurrentThread();
if (actor) {
ActorCreated(actor);
PBackgroundChild* actor = BackgroundChild::GetOrCreateForCurrentThread();
if (NS_WARN_IF(!actor)) {
mStatus = NS_ERROR_UNEXPECTED;
return;
}
// Otherwise we must begin the PBackground initialization process and
// wait for the async ActorCreated() callback.
MOZ_ASSERT(NS_IsMainThread());
bool ok = BackgroundChild::GetOrCreateForCurrentThread(this);
if (NS_WARN_IF(!ok)) {
ActorFailed();
// WorkerHolder ownership is passed to the CacheStorageChild actor and any
// actors it may create. The WorkerHolder will keep the worker thread alive
// until the actors can gracefully shutdown.
CacheStorageChild* newActor = new CacheStorageChild(this, aWorkerHolder);
PCacheStorageChild* constructedActor =
actor->SendPCacheStorageConstructor(newActor, mNamespace, *mPrincipalInfo);
if (NS_WARN_IF(!constructedActor)) {
mStatus = NS_ERROR_UNEXPECTED;
return;
}
MOZ_DIAGNOSTIC_ASSERT(constructedActor == newActor);
mActor = newActor;
}
CacheStorage::CacheStorage(nsresult aFailureResult)
@ -336,8 +341,7 @@ CacheStorage::Match(JSContext* aCx, const RequestOrUSVString& aRequest,
entry->mArgs = StorageMatchArgs(CacheRequest(), params, GetOpenMode());
entry->mRequest = request;
mPendingRequests.AppendElement(entry.forget());
MaybeRunPendingRequests();
RunRequest(Move(entry));
return promise.forget();
}
@ -361,8 +365,7 @@ CacheStorage::Has(const nsAString& aKey, ErrorResult& aRv)
entry->mPromise = promise;
entry->mArgs = StorageHasArgs(nsString(aKey));
mPendingRequests.AppendElement(entry.forget());
MaybeRunPendingRequests();
RunRequest(Move(entry));
return promise.forget();
}
@ -386,8 +389,7 @@ CacheStorage::Open(const nsAString& aKey, ErrorResult& aRv)
entry->mPromise = promise;
entry->mArgs = StorageOpenArgs(nsString(aKey));
mPendingRequests.AppendElement(entry.forget());
MaybeRunPendingRequests();
RunRequest(Move(entry));
return promise.forget();
}
@ -411,8 +413,7 @@ CacheStorage::Delete(const nsAString& aKey, ErrorResult& aRv)
entry->mPromise = promise;
entry->mArgs = StorageDeleteArgs(nsString(aKey));
mPendingRequests.AppendElement(entry.forget());
MaybeRunPendingRequests();
RunRequest(Move(entry));
return promise.forget();
}
@ -436,8 +437,7 @@ CacheStorage::Keys(ErrorResult& aRv)
entry->mPromise = promise;
entry->mArgs = StorageKeysArgs();
mPendingRequests.AppendElement(entry.forget());
MaybeRunPendingRequests();
RunRequest(Move(entry));
return promise.forget();
}
@ -498,66 +498,19 @@ CacheStorage::WrapObject(JSContext* aContext, JS::Handle<JSObject*> aGivenProto)
return mozilla::dom::CacheStorageBinding::Wrap(aContext, this, aGivenProto);
}
void
CacheStorage::ActorCreated(PBackgroundChild* aActor)
{
NS_ASSERT_OWNINGTHREAD(CacheStorage);
MOZ_DIAGNOSTIC_ASSERT(aActor);
if (NS_WARN_IF(mWorkerHolder && mWorkerHolder->Notified())) {
ActorFailed();
return;
}
// WorkerHolder ownership is passed to the CacheStorageChild actor and any
// actors it may create. The WorkerHolder will keep the worker thread alive
// until the actors can gracefully shutdown.
CacheStorageChild* newActor = new CacheStorageChild(this, mWorkerHolder);
PCacheStorageChild* constructedActor =
aActor->SendPCacheStorageConstructor(newActor, mNamespace, *mPrincipalInfo);
if (NS_WARN_IF(!constructedActor)) {
ActorFailed();
return;
}
mWorkerHolder = nullptr;
MOZ_DIAGNOSTIC_ASSERT(constructedActor == newActor);
mActor = newActor;
MaybeRunPendingRequests();
MOZ_DIAGNOSTIC_ASSERT(mPendingRequests.IsEmpty());
}
void
CacheStorage::ActorFailed()
{
NS_ASSERT_OWNINGTHREAD(CacheStorage);
MOZ_DIAGNOSTIC_ASSERT(!NS_FAILED(mStatus));
mStatus = NS_ERROR_UNEXPECTED;
mWorkerHolder = nullptr;
for (uint32_t i = 0; i < mPendingRequests.Length(); ++i) {
nsAutoPtr<Entry> entry(mPendingRequests[i].forget());
entry->mPromise->MaybeReject(NS_ERROR_UNEXPECTED);
}
mPendingRequests.Clear();
}
void
CacheStorage::DestroyInternal(CacheStorageChild* aActor)
{
NS_ASSERT_OWNINGTHREAD(CacheStorage);
MOZ_DIAGNOSTIC_ASSERT(mActor);
MOZ_DIAGNOSTIC_ASSERT(mActor == aActor);
MOZ_DIAGNOSTIC_ASSERT(!NS_FAILED(mStatus));
mActor->ClearListener();
mActor = nullptr;
mStatus = NS_ERROR_UNEXPECTED;
// Note that we will never get an actor again in case another request is
// made before this object is destructed.
ActorFailed();
}
nsIGlobalObject*
@ -595,26 +548,24 @@ CacheStorage::~CacheStorage()
}
void
CacheStorage::MaybeRunPendingRequests()
CacheStorage::RunRequest(nsAutoPtr<Entry>&& aEntry)
{
if (!mActor) {
return;
}
MOZ_ASSERT(mActor);
for (uint32_t i = 0; i < mPendingRequests.Length(); ++i) {
nsAutoPtr<Entry> entry(Move(aEntry));
AutoChildOpArgs args(this, entry->mArgs, 1);
if (entry->mRequest) {
ErrorResult rv;
nsAutoPtr<Entry> entry(mPendingRequests[i].forget());
AutoChildOpArgs args(this, entry->mArgs, 1);
if (entry->mRequest) {
args.Add(entry->mRequest, IgnoreBody, IgnoreInvalidScheme, rv);
}
args.Add(entry->mRequest, IgnoreBody, IgnoreInvalidScheme, rv);
if (NS_WARN_IF(rv.Failed())) {
entry->mPromise->MaybeReject(rv);
continue;
return;
}
mActor->ExecuteOp(mGlobal, entry->mPromise, this, args.SendAsOpArgs());
}
mPendingRequests.Clear();
mActor->ExecuteOp(mGlobal, entry->mPromise, this, args.SendAsOpArgs());
}
OpenMode

View File

@ -14,7 +14,6 @@
#include "nsISupportsImpl.h"
#include "nsTArray.h"
#include "nsWrapperCache.h"
#include "nsIIPCBackgroundChildCreateCallback.h"
class nsIGlobalObject;
@ -40,7 +39,7 @@ namespace cache {
class CacheStorageChild;
class CacheWorkerHolder;
class CacheStorage final : public nsIIPCBackgroundChildCreateCallback
class CacheStorage final : public nsISupports
, public nsWrapperCache
, public TypeUtils
{
@ -79,10 +78,6 @@ public:
nsISupports* GetParentObject() const;
virtual JSObject* WrapObject(JSContext* aContext, JS::Handle<JSObject*> aGivenProto) override;
// nsIIPCbackgroundChildCreateCallback methods
virtual void ActorCreated(PBackgroundChild* aActor) override;
virtual void ActorFailed() override;
// Called when CacheStorageChild actor is being destroyed
void DestroyInternal(CacheStorageChild* aActor);
@ -102,7 +97,8 @@ private:
explicit CacheStorage(nsresult aFailureResult);
~CacheStorage();
void MaybeRunPendingRequests();
struct Entry;
void RunRequest(nsAutoPtr<Entry>&& aEntry);
OpenMode
GetOpenMode() const;
@ -110,20 +106,15 @@ private:
const Namespace mNamespace;
nsCOMPtr<nsIGlobalObject> mGlobal;
UniquePtr<mozilla::ipc::PrincipalInfo> mPrincipalInfo;
RefPtr<CacheWorkerHolder> mWorkerHolder;
// weak ref cleared in DestroyInternal
CacheStorageChild* mActor;
struct Entry;
nsTArray<nsAutoPtr<Entry>> mPendingRequests;
nsresult mStatus;
public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(CacheStorage,
nsIIPCBackgroundChildCreateCallback)
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(CacheStorage)
};
} // namespace cache

View File

@ -6570,7 +6570,7 @@ skip-if = (os == 'android' || os == 'linux')
[generated/test_2_conformance__glsl__misc__shader-struct-scope.html]
skip-if = (os == 'android' || os == 'linux')
[generated/test_2_conformance__glsl__misc__shader-uniform-packing-restrictions.html]
skip-if = (os == 'android' || os == 'linux')
skip-if = (os == 'win' && os_version == '6.1' && debug) || (os == 'android' || os == 'linux')
[generated/test_2_conformance__glsl__misc__shader-varying-packing-restrictions.html]
skip-if = (os == 'android' || os == 'linux')
[generated/test_2_conformance__glsl__misc__shader-with-256-character-define.html]

View File

@ -933,6 +933,9 @@ skip-if = (os == 'win' && os_version == '6.1')
[generated/test_2_conformance__glsl__constructors__glsl-construct-vec4.html]
# Failure on win7 but got passed on win7 vm
skip-if = (os == 'win' && os_version == '6.1')
[generated/test_2_conformance__glsl__misc__shader-uniform-packing-restrictions.html]
# Failures on win7/debug on oct 20th, 2017, bug 1410306
skip-if = (os == 'win' && os_version == '6.1' && debug)
[generated/test_2_conformance__textures__misc__tex-image-and-sub-image-2d-with-array-buffer-view.html]
# Failure on win7 but got passed on win7 vm
skip-if = (os == 'win' && os_version == '6.1')

View File

@ -550,39 +550,18 @@ MutableBlobStorage::ShouldBeTemporaryStorage(uint64_t aSize) const
void
MutableBlobStorage::MaybeCreateTemporaryFile()
{
MOZ_ASSERT(NS_IsMainThread());
mStorageState = eWaitingForTemporaryFile;
mozilla::ipc::PBackgroundChild* actor =
mozilla::ipc::BackgroundChild::GetForCurrentThread();
if (actor) {
ActorCreated(actor);
} else {
mozilla::ipc::BackgroundChild::GetOrCreateForCurrentThread(this);
}
}
void
MutableBlobStorage::ActorFailed()
{
MOZ_CRASH("Failed to create a PBackgroundChild actor!");
}
void
MutableBlobStorage::ActorCreated(PBackgroundChild* aActor)
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(mStorageState == eWaitingForTemporaryFile ||
mStorageState == eClosed);
MOZ_ASSERT_IF(mPendingCallback, mStorageState == eClosed);
// If the object has been already closed and we don't need to execute a
// callback, we have nothing else to do.
if (mStorageState == eClosed && !mPendingCallback) {
return;
mozilla::ipc::PBackgroundChild* actorChild =
mozilla::ipc::BackgroundChild::GetOrCreateForCurrentThread();
if (NS_WARN_IF(!actorChild)) {
MOZ_CRASH("Failed to create a PBackgroundChild actor!");
}
mActor = new TemporaryIPCBlobChild(this);
aActor->SendPTemporaryIPCBlobConstructor(mActor);
actorChild->SendPTemporaryIPCBlobConstructor(mActor);
// We need manually to increase the reference for this actor because the
// IPC allocator method is not triggered. The Release() is called by IPDL
@ -696,7 +675,5 @@ MutableBlobStorage::SizeOfCurrentMemoryBuffer() const
return mStorageState < eInTemporaryFile ? mDataLen : 0;
}
NS_IMPL_ISUPPORTS(MutableBlobStorage, nsIIPCBackgroundChildCreateCallback)
} // dom namespace
} // mozilla namespace

View File

@ -8,7 +8,6 @@
#define mozilla_dom_MutableBlobStorage_h
#include "mozilla/RefPtr.h"
#include "nsIIPCBackgroundChildCreateCallback.h"
#include "prio.h"
class nsIEventTarget;
@ -37,11 +36,10 @@ public:
};
// This class is main-thread only.
class MutableBlobStorage final : public nsIIPCBackgroundChildCreateCallback
class MutableBlobStorage final
{
public:
NS_DECL_NSIIPCBACKGROUNDCHILDCREATECALLBACK
NS_DECL_THREADSAFE_ISUPPORTS
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(MutableBlobStorage)
enum MutableBlobStorageType
{

View File

@ -11,7 +11,6 @@
#include "mozilla/TaskCategory.h"
#include "mozilla/ipc/BackgroundChild.h"
#include "mozilla/ipc/PBackgroundChild.h"
#include "nsIIPCBackgroundChildCreateCallback.h"
#include "nsXPCOMPrivate.h"
namespace mozilla {
@ -42,11 +41,8 @@ public:
};
class MigrateActorRunnable final : public Runnable
, public nsIIPCBackgroundChildCreateCallback
{
public:
NS_DECL_ISUPPORTS_INHERITED
explicit MigrateActorRunnable(IPCBlobInputStreamChild* aActor)
: Runnable("dom::MigrateActorRunnable")
, mActor(aActor)
@ -56,30 +52,25 @@ public:
NS_IMETHOD
Run() override
{
BackgroundChild::GetOrCreateForCurrentThread(this);
return NS_OK;
}
void
ActorFailed() override
{
// We cannot continue. We are probably shutting down.
}
void
ActorCreated(mozilla::ipc::PBackgroundChild* aActor) override
{
MOZ_ASSERT(mActor->State() == IPCBlobInputStreamChild::eInactiveMigrating);
if (aActor->SendPIPCBlobInputStreamConstructor(mActor, mActor->ID(),
mActor->Size())) {
PBackgroundChild* actorChild =
BackgroundChild::GetOrCreateForCurrentThread();
if (!actorChild) {
return NS_OK;
}
if (actorChild->SendPIPCBlobInputStreamConstructor(mActor, mActor->ID(),
mActor->Size())) {
// We need manually to increase the reference for this actor because the
// IPC allocator method is not triggered. The Release() is called by IPDL
// when the actor is deleted.
mActor.get()->AddRef();
mActor->Migrated();
}
return NS_OK;
}
private:
@ -88,9 +79,6 @@ private:
RefPtr<IPCBlobInputStreamChild> mActor;
};
NS_IMPL_ISUPPORTS_INHERITED(MigrateActorRunnable, Runnable,
nsIIPCBackgroundChildCreateCallback)
} // anonymous
NS_IMPL_ISUPPORTS(IPCBlobInputStreamThread, nsIObserver, nsIEventTarget)

View File

@ -105,8 +105,6 @@ private:
} // anonymous namespace
NS_IMPL_ISUPPORTS(FileSystemTaskChildBase, nsIIPCBackgroundChildCreateCallback)
/**
* FileSystemTaskBase class
*/
@ -140,35 +138,9 @@ FileSystemTaskChildBase::Start()
mFileSystem->AssertIsOnOwningThread();
mozilla::ipc::PBackgroundChild* actor =
mozilla::ipc::BackgroundChild::GetForCurrentThread();
if (actor) {
ActorCreated(actor);
} else {
if (NS_WARN_IF(
!mozilla::ipc::BackgroundChild::GetOrCreateForCurrentThread(this))) {
MOZ_CRASH();
}
}
}
void
FileSystemTaskChildBase::ActorFailed()
{
MOZ_CRASH("Failed to create a PBackgroundChild actor!");
}
void
FileSystemTaskChildBase::ActorCreated(mozilla::ipc::PBackgroundChild* aActor)
{
if (HasError()) {
// In this case we don't want to use IPC at all.
RefPtr<ErrorRunnable> runnable = new ErrorRunnable(this);
FileSystemUtils::DispatchRunnable(mGlobalObject, runnable.forget());
return;
}
if (mFileSystem->IsShutdown()) {
return;
mozilla::ipc::BackgroundChild::GetOrCreateForCurrentThread();
if (NS_WARN_IF(!actor)) {
MOZ_CRASH("Failed to create a PBackgroundChild actor!");
}
nsAutoString serialization;
@ -190,10 +162,10 @@ FileSystemTaskChildBase::ActorCreated(mozilla::ipc::PBackgroundChild* aActor)
nsIEventTarget* target = mGlobalObject->EventTargetFor(TaskCategory::Other);
MOZ_ASSERT(target);
aActor->SetEventTargetForActor(this, target);
actor->SetEventTargetForActor(this, target);
}
aActor->SendPFileSystemRequestConstructor(this, params);
actor->SendPFileSystemRequestConstructor(this, params);
}
void

View File

@ -10,7 +10,6 @@
#include "mozilla/ErrorResult.h"
#include "mozilla/dom/FileSystemRequestParent.h"
#include "mozilla/dom/PFileSystemRequestChild.h"
#include "nsIIPCBackgroundChildCreateCallback.h"
#include "nsThreadUtils.h"
namespace mozilla {
@ -99,11 +98,9 @@ class FileSystemParams;
* (8) Call [HandlerCallback] to send the task result to the content page.
*/
class FileSystemTaskChildBase : public PFileSystemRequestChild
, public nsIIPCBackgroundChildCreateCallback
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIIPCBACKGROUNDCHILDCREATECALLBACK
NS_INLINE_DECL_REFCOUNTING(FileSystemTaskChildBase)
/*
* Start the task. It will dispatch all the information to the parent process,

View File

@ -140,12 +140,28 @@ GamepadManager::AddListener(nsGlobalWindow* aWindow)
// IPDL child has not been created
if (mChannelChildren.IsEmpty()) {
PBackgroundChild *actor = BackgroundChild::GetForCurrentThread();
//Try to get the PBackground Child actor
if (actor) {
ActorCreated(actor);
} else {
Unused << BackgroundChild::GetOrCreateForCurrentThread(this);
PBackgroundChild* actor = BackgroundChild::GetOrCreateForCurrentThread();
if (NS_WARN_IF(!actor)) {
MOZ_CRASH("Failed to create a PBackgroundChild actor!");
}
GamepadEventChannelChild *child = new GamepadEventChannelChild();
PGamepadEventChannelChild *initedChild =
actor->SendPGamepadEventChannelConstructor(child);
if (NS_WARN_IF(!initedChild)) {
MOZ_CRASH("Failed to create a PBackgroundChild actor!");
return;
}
MOZ_ASSERT(initedChild == child);
child->SendGamepadListenerAdded();
mChannelChildren.AppendElement(child);
if (gfx::VRManagerChild::IsCreated()) {
// Construct VRManagerChannel and ask adding the connected
// VR controllers to GamepadManager
gfx::VRManagerChild* vm = gfx::VRManagerChild::Get();
vm->SendControllerListenerAdded();
}
}
@ -693,36 +709,5 @@ GamepadManager::StopHaptics()
}
}
//Override nsIIPCBackgroundChildCreateCallback
void
GamepadManager::ActorCreated(PBackgroundChild *aActor)
{
MOZ_ASSERT(aActor);
GamepadEventChannelChild *child = new GamepadEventChannelChild();
PGamepadEventChannelChild *initedChild =
aActor->SendPGamepadEventChannelConstructor(child);
if (NS_WARN_IF(!initedChild)) {
ActorFailed();
return;
}
MOZ_ASSERT(initedChild == child);
child->SendGamepadListenerAdded();
mChannelChildren.AppendElement(child);
if (gfx::VRManagerChild::IsCreated()) {
// Construct VRManagerChannel and ask adding the connected
// VR controllers to GamepadManager
gfx::VRManagerChild* vm = gfx::VRManagerChild::Get();
vm->SendControllerListenerAdded();
}
}
//Override nsIIPCBackgroundChildCreateCallback
void
GamepadManager::ActorFailed()
{
MOZ_CRASH("Gamepad IPC actor create failed!");
}
} // namespace dom
} // namespace mozilla

View File

@ -7,7 +7,6 @@
#ifndef mozilla_dom_GamepadManager_h_
#define mozilla_dom_GamepadManager_h_
#include "nsIIPCBackgroundChildCreateCallback.h"
#include "nsIObserver.h"
// Needed for GamepadMappingType
#include "mozilla/dom/GamepadBinding.h"
@ -26,13 +25,11 @@ class Gamepad;
class GamepadChangeEvent;
class GamepadEventChannelChild;
class GamepadManager final : public nsIObserver,
public nsIIPCBackgroundChildCreateCallback
class GamepadManager final : public nsIObserver
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIOBSERVER
NS_DECL_NSIIPCBACKGROUNDCHILDCREATECALLBACK
// Returns true if we actually have a service up and running
static bool IsServiceRunning();

View File

@ -35,7 +35,6 @@ NS_IMPL_CYCLE_COLLECTION_INHERITED(GamepadServiceTest, DOMEventTargetHelper,
mWindow)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(GamepadServiceTest)
NS_INTERFACE_MAP_ENTRY(nsIIPCBackgroundChildCreateCallback)
NS_INTERFACE_MAP_END_INHERITING(DOMEventTargetHelper)
NS_IMPL_ADDREF_INHERITED(GamepadServiceTest, DOMEventTargetHelper)
@ -74,31 +73,25 @@ void
GamepadServiceTest::InitPBackgroundActor()
{
MOZ_ASSERT(!mChild);
PBackgroundChild *actor = BackgroundChild::GetForCurrentThread();
//Try to get the PBackground Child actor
if (actor) {
ActorCreated(actor);
} else {
Unused << BackgroundChild::GetOrCreateForCurrentThread(this);
PBackgroundChild* actor = BackgroundChild::GetOrCreateForCurrentThread();
if (NS_WARN_IF(!actor)) {
MOZ_CRASH("Failed to create a PBackgroundChild actor!");
}
mChild = new GamepadTestChannelChild();
PGamepadTestChannelChild* initedChild =
actor->SendPGamepadTestChannelConstructor(mChild);
if (NS_WARN_IF(!initedChild)) {
MOZ_CRASH("Failed to create a PBackgroundChild actor!");
}
}
void
GamepadServiceTest::DestroyPBackgroundActor()
{
if (mChild) {
// If mChild exists, which means that IPDL channel
// has been created, our pending operations should
// be empty.
MOZ_ASSERT(mPendingOperations.IsEmpty());
mChild->SendShutdownChannel();
mChild = nullptr;
} else {
// If the IPDL channel has not been created and we
// want to destroy it now, just cancel all pending
// operations.
mPendingOperations.Clear();
}
mChild->SendShutdownChannel();
mChild = nullptr;
}
already_AddRefed<Promise>
@ -128,13 +121,10 @@ GamepadServiceTest::AddGamepad(const nsAString& aID,
}
uint32_t id = ++mEventNumber;
if (mChild) {
mChild->AddPromise(id, p);
mChild->SendGamepadTestEvent(id, e);
} else {
PendingOperation op(id, e, p);
mPendingOperations.AppendElement(op);
}
mChild->AddPromise(id, p);
mChild->SendGamepadTestEvent(id, e);
return p.forget();
}
@ -150,12 +140,7 @@ GamepadServiceTest::RemoveGamepad(uint32_t aIndex)
GamepadChangeEvent e(aIndex, GamepadServiceType::Standard, body);
uint32_t id = ++mEventNumber;
if (mChild) {
mChild->SendGamepadTestEvent(id, e);
} else {
PendingOperation op(id, e);
mPendingOperations.AppendElement(op);
}
mChild->SendGamepadTestEvent(id, e);
}
void
@ -173,12 +158,7 @@ GamepadServiceTest::NewButtonEvent(uint32_t aIndex,
GamepadChangeEvent e(aIndex, GamepadServiceType::Standard, body);
uint32_t id = ++mEventNumber;
if (mChild) {
mChild->SendGamepadTestEvent(id, e);
} else {
PendingOperation op(id, e);
mPendingOperations.AppendElement(op);
}
mChild->SendGamepadTestEvent(id, e);
}
void
@ -197,12 +177,7 @@ GamepadServiceTest::NewButtonValueEvent(uint32_t aIndex,
GamepadChangeEvent e(aIndex, GamepadServiceType::Standard, body);
uint32_t id = ++mEventNumber;
if (mChild) {
mChild->SendGamepadTestEvent(id, e);
} else {
PendingOperation op(id, e);
mPendingOperations.AppendElement(op);
}
mChild->SendGamepadTestEvent(id, e);
}
void
@ -219,12 +194,7 @@ GamepadServiceTest::NewAxisMoveEvent(uint32_t aIndex,
GamepadChangeEvent e(aIndex, GamepadServiceType::Standard, body);
uint32_t id = ++mEventNumber;
if (mChild) {
mChild->SendGamepadTestEvent(id, e);
} else {
PendingOperation op(id, e);
mPendingOperations.AppendElement(op);
}
mChild->SendGamepadTestEvent(id, e);
}
void
@ -302,54 +272,7 @@ GamepadServiceTest::NewPoseMove(uint32_t aIndex,
GamepadChangeEvent e(aIndex, GamepadServiceType::Standard, body);
uint32_t id = ++mEventNumber;
if (mChild) {
mChild->SendGamepadTestEvent(id, e);
} else {
PendingOperation op(id, e);
mPendingOperations.AppendElement(op);
}
}
void
GamepadServiceTest::FlushPendingOperations()
{
for (uint32_t i=0; i < mPendingOperations.Length(); ++i) {
PendingOperation op = mPendingOperations[i];
if (op.mPromise) {
mChild->AddPromise(op.mID, op.mPromise);
}
mChild->SendGamepadTestEvent(op.mID, op.mEvent);
}
mPendingOperations.Clear();
}
void
GamepadServiceTest::ActorCreated(PBackgroundChild* aActor)
{
MOZ_ASSERT(aActor);
// If we are shutting down, we don't need to create the
// IPDL child/parent pair anymore.
if (mShuttingDown) {
// mPendingOperations should be cleared in
// DestroyPBackgroundActor()
MOZ_ASSERT(mPendingOperations.IsEmpty());
return;
}
mChild = new GamepadTestChannelChild();
PGamepadTestChannelChild* initedChild =
aActor->SendPGamepadTestChannelConstructor(mChild);
if (NS_WARN_IF(!initedChild)) {
ActorFailed();
return;
}
FlushPendingOperations();
}
void
GamepadServiceTest::ActorFailed()
{
MOZ_CRASH("Failed to create background child actor!");
mChild->SendGamepadTestEvent(id, e);
}
JSObject*

View File

@ -7,7 +7,6 @@
#ifndef mozilla_dom_GamepadServiceTest_h_
#define mozilla_dom_GamepadServiceTest_h_
#include "nsIIPCBackgroundChildCreateCallback.h"
#include "mozilla/DOMEventTargetHelper.h"
#include "mozilla/dom/GamepadBinding.h"
@ -20,11 +19,9 @@ class GamepadTestChannelChild;
class Promise;
// Service for testing purposes
class GamepadServiceTest final : public DOMEventTargetHelper,
public nsIIPCBackgroundChildCreateCallback
class GamepadServiceTest final : public DOMEventTargetHelper
{
public:
NS_DECL_NSIIPCBACKGROUNDCHILDCREATECALLBACK
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(GamepadServiceTest,
DOMEventTargetHelper)
@ -62,24 +59,10 @@ public:
private:
// We need to asynchronously create IPDL channel, it is possible that
// we send commands before the channel is created, so we have to buffer
// them until the channel is created in that case.
struct PendingOperation {
explicit PendingOperation(const uint32_t& aID,
const GamepadChangeEvent& aEvent,
Promise* aPromise = nullptr)
: mID(aID), mEvent(aEvent), mPromise(aPromise) {}
uint32_t mID;
const GamepadChangeEvent& mEvent;
RefPtr<Promise> mPromise;
};
// Hold a reference to the gamepad service so we don't have to worry about
// execution order in tests.
RefPtr<GamepadManager> mService;
nsCOMPtr<nsPIDOMWindowInner> mWindow;
nsTArray<PendingOperation> mPendingOperations;
uint32_t mEventNumber;
bool mShuttingDown;
@ -92,7 +75,6 @@ private:
~GamepadServiceTest();
void InitPBackgroundActor();
void DestroyPBackgroundActor();
void FlushPendingOperations();
};

View File

@ -546,7 +546,6 @@ skip-if = true # Disabled for timeouts.
[test_viewport.html]
[test_documentAll.html]
[test_document-element-inserted.html]
[test_document.watch.html]
[test_bug445004.html]
skip-if = true || toolkit == 'android' # Disabled permanently (bug 559932).
[test_bug446483.html]

View File

@ -1,129 +0,0 @@
<!DOCTYPE html>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=903332
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 903332</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript">
/** Test for Bug 903332 **/
var watch1Called;
function watch1(prop, oldValue, newValue)
{
is(watch1Called, false, "watch1Called not reset properly?");
watch1Called = true;
is(prop, "cookie", "wrong property name passed to watch1");
return newValue;
}
var watch2Called;
function watch2(prop, oldValue, newValue)
{
is(watch2Called, false, "watch2Called not reset properly?");
watch2Called = true;
is(prop, "cookie", "wrong property name passed to watch2");
return newValue;
}
// Just in case subsequent tests depend on a particular value...
var originalValue = document.cookie;
ok(true, "originalValue: " + originalValue);
var originalPrefix = originalValue.length > 0 ? originalValue + "; " : "";
try
{
// trial set (no watch) to verify things work
document.cookie = "first=set";
is(document.cookie, originalPrefix + "first=set",
"first value correct");
// add a watch
document.watch("cookie", watch1);
// set, check for watch invoked
watch1Called = false;
document.cookie = "second=set";
is(watch1Called, true, "watch1 function should be called");
is(document.cookie, originalPrefix + "first=set; second=set",
"second value correct");
// and a second time, just in case
watch1Called = false;
document.cookie = "third=set";
is(watch1Called, true, "watch1 function should be called");
is(document.cookie, originalPrefix + "first=set; second=set; third=set",
"third value correct");
// overwrite the current watch with a new one
document.watch("cookie", watch2);
// set, check for watch invoked
watch1Called = false;
watch2Called = false;
document.cookie = "fourth=set";
is(watch1Called, false, "watch1 invoked erroneously");
is(watch2Called, true, "watch2 function should be called");
is(document.cookie, originalPrefix + "first=set; second=set; third=set; fourth=set",
"fourth value correct");
// and a second time, just in case
watch1Called = false;
watch2Called = false;
document.cookie = "fifth=set";
is(watch1Called, false, "watch1 invoked erroneously");
is(watch2Called, true, "watch2 function should be called");
is(document.cookie, originalPrefix + "first=set; second=set; third=set; fourth=set; fifth=set",
"fifth value correct");
// remove the watch
document.unwatch("cookie");
// check for non-invocation now
watch1Called = false;
watch2Called = false;
document.cookie = "sixth=set";
is(watch1Called, false, "watch1 shouldn't be called");
is(watch2Called, false, "watch2 shouldn't be called");
is(document.cookie, originalPrefix + "first=set; second=set; third=set; fourth=set; fifth=set; sixth=set",
"sixth value correct");
}
finally
{
// reset
document.unwatch("cookie"); // harmless, should be no-op except if bugs
var d = new Date();
d.setTime(0);
var suffix = "=; expires=" + d.toGMTString();
document.cookie = "first" + suffix;
document.cookie = "second" + suffix;
document.cookie = "third" + suffix;
document.cookie = "fourth" + suffix;
document.cookie = "fifth" + suffix;
document.cookie = "sixth" + suffix;
}
is(document.cookie, originalValue,
"document.cookie isn't what it was initially! expect bustage further " +
"down the line");
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=903332">Mozilla Bug 903332</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
</html>

View File

@ -25,7 +25,6 @@
#include "nsContentUtils.h"
#include "nsGlobalWindow.h"
#include "nsIAboutModule.h"
#include "nsIIPCBackgroundChildCreateCallback.h"
#include "nsILoadContext.h"
#include "nsIPrincipal.h"
#include "nsIURI.h"
@ -56,31 +55,6 @@ const char kPrefIndexedDBEnabled[] = "dom.indexedDB.enabled";
} // namespace
class IDBFactory::BackgroundCreateCallback final
: public nsIIPCBackgroundChildCreateCallback
{
RefPtr<IDBFactory> mFactory;
LoggingInfo mLoggingInfo;
public:
explicit
BackgroundCreateCallback(IDBFactory* aFactory,
const LoggingInfo& aLoggingInfo)
: mFactory(aFactory)
, mLoggingInfo(aLoggingInfo)
{
MOZ_ASSERT(aFactory);
}
NS_DECL_ISUPPORTS
private:
~BackgroundCreateCallback()
{ }
NS_DECL_NSIIPCBACKGROUNDCHILDCREATECALLBACK
};
struct IDBFactory::PendingRequestInfo
{
RefPtr<IDBOpenDBRequest> mRequest;
@ -706,7 +680,7 @@ IDBFactory::OpenInternal(JSContext* aCx,
params = OpenDatabaseRequestParams(commonParams);
}
if (!mBackgroundActor && mPendingRequests.IsEmpty()) {
if (!mBackgroundActor) {
BackgroundChildImpl::ThreadLocal* threadLocal =
BackgroundChildImpl::GetThreadLocalForCurrentThread();
@ -726,14 +700,28 @@ IDBFactory::OpenInternal(JSContext* aCx,
newIDBThreadLocal = idbThreadLocal = new ThreadLocal(id);
}
if (PBackgroundChild* actor = BackgroundChild::GetForCurrentThread()) {
BackgroundActorCreated(actor, idbThreadLocal->GetLoggingInfo());
} else {
// We need to start the sequence to create a background actor for this
// thread.
RefPtr<BackgroundCreateCallback> cb =
new BackgroundCreateCallback(this, idbThreadLocal->GetLoggingInfo());
if (NS_WARN_IF(!BackgroundChild::GetOrCreateForCurrentThread(cb))) {
PBackgroundChild* backgroundActor =
BackgroundChild::GetOrCreateForCurrentThread();
if (NS_WARN_IF(!backgroundActor)) {
IDB_REPORT_INTERNAL_ERR();
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
return nullptr;
}
{
BackgroundFactoryChild* actor = new BackgroundFactoryChild(this);
// Set EventTarget for the top-level actor.
// All child actors created later inherit the same event target.
backgroundActor->SetEventTargetForActor(actor, EventTarget());
MOZ_ASSERT(actor->GetActorEventTarget());
mBackgroundActor =
static_cast<BackgroundFactoryChild*>(
backgroundActor->SendPBackgroundIDBFactoryConstructor(actor,
idbThreadLocal->GetLoggingInfo()));
if (NS_WARN_IF(!mBackgroundActor)) {
mBackgroundActorFailed = true;
IDB_REPORT_INTERNAL_ERR();
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
return nullptr;
@ -789,88 +777,16 @@ IDBFactory::OpenInternal(JSContext* aCx,
IDB_LOG_STRINGIFY(aVersion));
}
// If we already have a background actor then we can start this request now.
if (mBackgroundActor) {
nsresult rv = InitiateRequest(request, params);
if (NS_WARN_IF(NS_FAILED(rv))) {
IDB_REPORT_INTERNAL_ERR();
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
return nullptr;
}
} else {
mPendingRequests.AppendElement(new PendingRequestInfo(request, params));
nsresult rv = InitiateRequest(request, params);
if (NS_WARN_IF(NS_FAILED(rv))) {
IDB_REPORT_INTERNAL_ERR();
aRv.Throw(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
return nullptr;
}
return request.forget();
}
nsresult
IDBFactory::BackgroundActorCreated(PBackgroundChild* aBackgroundActor,
const LoggingInfo& aLoggingInfo)
{
MOZ_ASSERT(aBackgroundActor);
MOZ_ASSERT(!mBackgroundActor);
MOZ_ASSERT(!mBackgroundActorFailed);
{
BackgroundFactoryChild* actor = new BackgroundFactoryChild(this);
// Set EventTarget for the top-level actor.
// All child actors created later inherit the same event target.
aBackgroundActor->SetEventTargetForActor(actor, EventTarget());
MOZ_ASSERT(actor->GetActorEventTarget());
mBackgroundActor =
static_cast<BackgroundFactoryChild*>(
aBackgroundActor->SendPBackgroundIDBFactoryConstructor(actor,
aLoggingInfo));
}
if (NS_WARN_IF(!mBackgroundActor)) {
BackgroundActorFailed();
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
}
nsresult rv = NS_OK;
for (uint32_t index = 0, count = mPendingRequests.Length();
index < count;
index++) {
nsAutoPtr<PendingRequestInfo> info(mPendingRequests[index].forget());
nsresult rv2 = InitiateRequest(info->mRequest, info->mParams);
// Warn for every failure, but just return the first failure if there are
// multiple failures.
if (NS_WARN_IF(NS_FAILED(rv2)) && NS_SUCCEEDED(rv)) {
rv = rv2;
}
}
mPendingRequests.Clear();
return rv;
}
void
IDBFactory::BackgroundActorFailed()
{
MOZ_ASSERT(!mPendingRequests.IsEmpty());
MOZ_ASSERT(!mBackgroundActor);
MOZ_ASSERT(!mBackgroundActorFailed);
mBackgroundActorFailed = true;
for (uint32_t index = 0, count = mPendingRequests.Length();
index < count;
index++) {
nsAutoPtr<PendingRequestInfo> info(mPendingRequests[index].forget());
info->mRequest->
DispatchNonTransactionError(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
}
mPendingRequests.Clear();
}
nsresult
IDBFactory::InitiateRequest(IDBOpenDBRequest* aRequest,
const FactoryRequestParams& aParams)
@ -952,31 +868,5 @@ IDBFactory::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
return IDBFactoryBinding::Wrap(aCx, this, aGivenProto);
}
NS_IMPL_ISUPPORTS(IDBFactory::BackgroundCreateCallback,
nsIIPCBackgroundChildCreateCallback)
void
IDBFactory::BackgroundCreateCallback::ActorCreated(PBackgroundChild* aActor)
{
MOZ_ASSERT(aActor);
MOZ_ASSERT(mFactory);
RefPtr<IDBFactory> factory;
mFactory.swap(factory);
factory->BackgroundActorCreated(aActor, mLoggingInfo);
}
void
IDBFactory::BackgroundCreateCallback::ActorFailed()
{
MOZ_ASSERT(mFactory);
RefPtr<IDBFactory> factory;
mFactory.swap(factory);
factory->BackgroundActorFailed();
}
} // namespace dom
} // namespace mozilla

View File

@ -69,8 +69,6 @@ class IDBFactory final
// process.
RefPtr<TabChild> mTabChild;
nsTArray<nsAutoPtr<PendingRequestInfo>> mPendingRequests;
indexedDB::BackgroundFactoryChild* mBackgroundActor;
// A DocGroup-specific EventTarget if created by CreateForWindow().
@ -266,13 +264,6 @@ private:
CallerType aCallerType,
ErrorResult& aRv);
nsresult
BackgroundActorCreated(PBackgroundChild* aBackgroundActor,
const indexedDB::LoggingInfo& aLoggingInfo);
void
BackgroundActorFailed();
nsresult
InitiateRequest(IDBOpenDBRequest* aRequest,
const indexedDB::FactoryRequestParams& aParams);

View File

@ -107,7 +107,6 @@
#include "nsICycleCollectorListener.h"
#include "nsIIdlePeriod.h"
#include "nsIDragService.h"
#include "nsIIPCBackgroundChildCreateCallback.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsIMemoryReporter.h"
#include "nsIMemoryInfoDumper.h"
@ -468,31 +467,6 @@ ConsoleListener::Observe(nsIConsoleMessage* aMessage)
return NS_OK;
}
class BackgroundChildPrimer final :
public nsIIPCBackgroundChildCreateCallback
{
public:
BackgroundChildPrimer()
{ }
NS_DECL_ISUPPORTS
private:
~BackgroundChildPrimer() = default;
void
ActorCreated(PBackgroundChild* aActor) override
{
MOZ_ASSERT(aActor, "Failed to create a PBackgroundChild actor!");
}
void
ActorFailed() override
{
MOZ_CRASH("Failed to create a PBackgroundChild actor!");
}
};
#ifdef NIGHTLY_BUILD
/**
* The singleton of this class is registered with the HangMonitor as an
@ -516,8 +490,6 @@ public:
PendingInputEventHangAnnotator PendingInputEventHangAnnotator::sSingleton;
#endif
NS_IMPL_ISUPPORTS(BackgroundChildPrimer, nsIIPCBackgroundChildCreateCallback)
class ContentChild::ShutdownCanary final
{ };
@ -1167,9 +1139,8 @@ ContentChild::InitXPCOM(const XPCOMInitData& aXPCOMInit,
// background thread since we'll likely need database information very soon.
BackgroundChild::Startup();
nsCOMPtr<nsIIPCBackgroundChildCreateCallback> callback =
new BackgroundChildPrimer();
if (!BackgroundChild::GetOrCreateForCurrentThread(callback)) {
PBackgroundChild* actorChild = BackgroundChild::GetOrCreateForCurrentThread();
if (NS_WARN_IF(!actorChild)) {
MOZ_CRASH("Failed to create PBackgroundChild!");
}

View File

@ -196,7 +196,6 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(MessagePort,
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(MessagePort)
NS_INTERFACE_MAP_ENTRY(nsIIPCBackgroundChildCreateCallback)
NS_INTERFACE_MAP_ENTRY(nsIObserver)
NS_INTERFACE_MAP_END_INHERITING(DOMEventTargetHelper)
@ -235,50 +234,6 @@ private:
}
};
class ForceCloseHelper final : public nsIIPCBackgroundChildCreateCallback
{
public:
NS_DECL_ISUPPORTS
static void ForceClose(const MessagePortIdentifier& aIdentifier)
{
PBackgroundChild* actor =
mozilla::ipc::BackgroundChild::GetForCurrentThread();
if (actor) {
Unused << actor->SendMessagePortForceClose(aIdentifier.uuid(),
aIdentifier.destinationUuid(),
aIdentifier.sequenceId());
return;
}
RefPtr<ForceCloseHelper> helper = new ForceCloseHelper(aIdentifier);
if (NS_WARN_IF(!mozilla::ipc::BackgroundChild::GetOrCreateForCurrentThread(helper))) {
MOZ_CRASH();
}
}
private:
explicit ForceCloseHelper(const MessagePortIdentifier& aIdentifier)
: mIdentifier(aIdentifier)
{}
~ForceCloseHelper() {}
void ActorFailed() override
{
MOZ_CRASH("Failed to create a PBackgroundChild actor!");
}
void ActorCreated(mozilla::ipc::PBackgroundChild* aActor) override
{
ForceClose(mIdentifier);
}
const MessagePortIdentifier mIdentifier;
};
NS_IMPL_ISUPPORTS(ForceCloseHelper, nsIIPCBackgroundChildCreateCallback)
} // namespace
MessagePort::MessagePort(nsIGlobalObject* aGlobal)
@ -877,38 +832,16 @@ MessagePort::ConnectToPBackground()
{
mState = eStateEntangling;
PBackgroundChild* actor =
mozilla::ipc::BackgroundChild::GetForCurrentThread();
if (actor) {
ActorCreated(actor);
} else {
if (NS_WARN_IF(
!mozilla::ipc::BackgroundChild::GetOrCreateForCurrentThread(this))) {
MOZ_CRASH();
}
mozilla::ipc::PBackgroundChild* actorChild =
mozilla::ipc::BackgroundChild::GetOrCreateForCurrentThread();
if (NS_WARN_IF(!actorChild)) {
MOZ_CRASH("Failed to create a PBackgroundChild actor!");
}
}
void
MessagePort::ActorFailed()
{
MOZ_CRASH("Failed to create a PBackgroundChild actor!");
}
void
MessagePort::ActorCreated(mozilla::ipc::PBackgroundChild* aActor)
{
MOZ_ASSERT(aActor);
MOZ_ASSERT(!mActor);
MOZ_ASSERT(mIdentifier);
MOZ_ASSERT(mState == eStateEntangling ||
mState == eStateEntanglingForDisentangle ||
mState == eStateEntanglingForClose);
PMessagePortChild* actor =
aActor->SendPMessagePortConstructor(mIdentifier->uuid(),
mIdentifier->destinationUuid(),
mIdentifier->sequenceId());
actorChild->SendPMessagePortConstructor(mIdentifier->uuid(),
mIdentifier->destinationUuid(),
mIdentifier->sequenceId());
mActor = static_cast<MessagePortChild*>(actor);
MOZ_ASSERT(mActor);
@ -1003,7 +936,15 @@ MessagePort::RemoveDocFromBFCache()
/* static */ void
MessagePort::ForceClose(const MessagePortIdentifier& aIdentifier)
{
ForceCloseHelper::ForceClose(aIdentifier);
mozilla::ipc::PBackgroundChild* actorChild =
mozilla::ipc::BackgroundChild::GetOrCreateForCurrentThread();
if (NS_WARN_IF(!actorChild)) {
MOZ_CRASH("Failed to create a PBackgroundChild actor!");
}
Unused << actorChild->SendMessagePortForceClose(aIdentifier.uuid(),
aIdentifier.destinationUuid(),
aIdentifier.sequenceId());
}
void

View File

@ -10,7 +10,6 @@
#include "mozilla/Attributes.h"
#include "mozilla/DOMEventTargetHelper.h"
#include "nsAutoPtr.h"
#include "nsIIPCBackgroundChildCreateCallback.h"
#include "nsTArray.h"
#ifdef XP_WIN
@ -33,13 +32,11 @@ class WorkerHolder;
} // namespace workers
class MessagePort final : public DOMEventTargetHelper
, public nsIIPCBackgroundChildCreateCallback
, public nsIObserver
{
friend class PostMessageRunnable;
public:
NS_DECL_NSIIPCBACKGROUNDCHILDCREATECALLBACK
NS_DECL_NSIOBSERVER
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(MessagePort,

View File

@ -14,7 +14,6 @@
#include "mozilla/ipc/PBackgroundChild.h"
#include "mozilla/ipc/BackgroundUtils.h"
#include "mozilla/ipc/PBackgroundSharedTypes.h"
#include "nsIIPCBackgroundChildCreateCallback.h"
using mozilla::net::gNeckoChild;
@ -69,69 +68,6 @@ UDPSocketChild::~UDPSocketChild()
{
}
class UDPSocketBackgroundChildCallback final :
public nsIIPCBackgroundChildCreateCallback
{
bool* mDone;
public:
explicit UDPSocketBackgroundChildCallback(bool* aDone)
: mDone(aDone)
{
MOZ_ASSERT(!NS_IsMainThread());
MOZ_ASSERT(mDone);
MOZ_ASSERT(!*mDone);
}
NS_DECL_ISUPPORTS
private:
~UDPSocketBackgroundChildCallback()
{ }
virtual void
ActorCreated(PBackgroundChild* aActor) override
{
*mDone = true;
}
virtual void
ActorFailed() override
{
*mDone = true;
}
};
NS_IMPL_ISUPPORTS(UDPSocketBackgroundChildCallback, nsIIPCBackgroundChildCreateCallback)
nsresult
UDPSocketChild::CreatePBackgroundSpinUntilDone()
{
using mozilla::ipc::BackgroundChild;
// Spinning the event loop in MainThread would be dangerous
MOZ_ASSERT(!NS_IsMainThread());
MOZ_ASSERT(!BackgroundChild::GetForCurrentThread());
bool done = false;
nsCOMPtr<nsIIPCBackgroundChildCreateCallback> callback =
new UDPSocketBackgroundChildCallback(&done);
if (NS_WARN_IF(!BackgroundChild::GetOrCreateForCurrentThread(callback))) {
return NS_ERROR_FAILURE;
}
if (!SpinEventLoopUntil([&done]() { return done; })) {
return NS_ERROR_FAILURE;
}
if (NS_WARN_IF(!BackgroundChild::GetForCurrentThread())) {
return NS_ERROR_FAILURE;
}
return NS_OK;
}
// nsIUDPSocketChild Methods
NS_IMETHODIMP
@ -139,20 +75,12 @@ UDPSocketChild::SetBackgroundSpinsEvents()
{
using mozilla::ipc::BackgroundChild;
PBackgroundChild* existingBackgroundChild =
BackgroundChild::GetForCurrentThread();
// If it's not spun up yet, block until it is, and retry
if (!existingBackgroundChild) {
nsresult rv = CreatePBackgroundSpinUntilDone();
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
existingBackgroundChild =
BackgroundChild::GetForCurrentThread();
MOZ_ASSERT(existingBackgroundChild);
mBackgroundManager =
BackgroundChild::GetOrCreateForCurrentThread();
if (NS_WARN_IF(!mBackgroundManager)) {
return NS_ERROR_FAILURE;
}
// By now PBackground is guaranteed to be/have-been up
mBackgroundManager = existingBackgroundChild;
return NS_OK;
}

View File

@ -42,8 +42,6 @@ public:
UDPSocketChild();
virtual ~UDPSocketChild();
nsresult CreatePBackgroundSpinUntilDone();
virtual mozilla::ipc::IPCResult RecvCallbackOpened(const UDPAddressInfo& aAddressInfo) override;
virtual mozilla::ipc::IPCResult RecvCallbackConnected(const UDPAddressInfo& aAddressInfo) override;
virtual mozilla::ipc::IPCResult RecvCallbackClosed() override;

View File

@ -51,7 +51,8 @@ NS_IMPL_RELEASE_INHERITED(PaymentRequest, DOMEventTargetHelper)
bool
PaymentRequest::PrefEnabled(JSContext* aCx, JSObject* aObj)
{
return Preferences::GetBool("dom.payments.request.enabled");
return XRE_IsContentProcess() &&
Preferences::GetBool("dom.payments.request.enabled");
}
nsresult

View File

@ -14,6 +14,8 @@ support-files =
[test_abortPayment.html]
run-if = nightly_build # Bug 1390018: Depends on the Nightly-only UI service
[test_basiccard.html]
[test_block_none10s.html]
skip-if = e10s # Bug 1408250: Don't expose PaymentRequest Constructor in non-e10s
[test_canMakePayment.html]
run-if = nightly_build # Bug 1390737: Depends on the Nightly-only UI service
[test_constructor.html]

View File

@ -0,0 +1,58 @@
<!DOCTYPE html>
<html>
<head>
<title>Test for Bug 1408250</title>
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta content="utf-8" http-equiv="encoding">
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript">
"use strict";
SimpleTest.waitForExplicitFinish();
function testInNone10s() {
return new Promise((resolve,reject) => {
const supportedInstruments = [{
supportedMethods: "basic-card",
}];
const details = {
id: "simple details",
total: {
label: "Donation",
amount: { currency: "USD", value: "55.00" }
},
};
try {
const payRequest = new PaymentRequest(supportedInstruments, details);
ok(false, "Unexpected, new PaymentRequest() can not be used in non-e10s.");
} catch (err) {
ok(err.name, "ReferenceError",
"Expected ReferenceError when calling new PaymentRequest()");
}
resolve();
});
}
function runTests() {
testInNone10s()
.then(SimpleTest.finish)
.catch( e => {
ok(false, "Unexpected error: " + e.name);
SimpleTest.finish();
});
}
window.addEventListener('load', function() {
SpecialPowers.pushPrefEnv({
'set': [
['dom.payments.request.enabled', true],
]
}, runTests);
});
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1408250">Mozilla Bug 1408250</a>
</body>
</html>

View File

@ -538,7 +538,7 @@ private:
{
MOZ_COUNT_DTOR(OriginInfo);
MOZ_DIAGNOSTIC_ASSERT(!mQuotaObjects.Count());
MOZ_ASSERT(!mQuotaObjects.Count());
}
void
@ -3136,10 +3136,9 @@ QuotaObject::LockedMaybeUpdateSize(int64_t aSize, bool aTruncate)
MOZ_ASSERT(!lock->GetGroup().IsEmpty());
MOZ_ASSERT(lock->GetOriginScope().IsOrigin());
MOZ_ASSERT(!lock->GetOriginScope().GetOrigin().IsEmpty());
MOZ_DIAGNOSTIC_ASSERT(
!(lock->GetOriginScope().GetOrigin() == mOriginInfo->mOrigin &&
lock->GetPersistenceType().Value() == groupInfo->mPersistenceType),
"Deleted itself!");
MOZ_ASSERT(!(lock->GetOriginScope().GetOrigin() == mOriginInfo->mOrigin &&
lock->GetPersistenceType().Value() == groupInfo->mPersistenceType),
"Deleted itself!");
quotaManager->LockedRemoveQuotaForOrigin(
lock->GetPersistenceType().Value(),
@ -3482,8 +3481,8 @@ QuotaManager::CollectOriginsForEviction(
}
if (!match) {
MOZ_DIAGNOSTIC_ASSERT(!originInfo->mQuotaObjects.Count(),
"Inactive origin shouldn't have open files!");
MOZ_ASSERT(!originInfo->mQuotaObjects.Count(),
"Inactive origin shouldn't have open files!");
aInactiveOriginInfos.InsertElementSorted(originInfo,
OriginInfoLRUComparator());
}

View File

@ -17,7 +17,6 @@
#include "mozilla/ipc/BackgroundUtils.h"
#include "mozilla/ipc/PBackgroundChild.h"
#include "nsIIdleService.h"
#include "nsIIPCBackgroundChildCreateCallback.h"
#include "nsIObserverService.h"
#include "nsIScriptSecurityManager.h"
#include "nsXULAppAPI.h"
@ -96,28 +95,6 @@ private:
} // namespace
class QuotaManagerService::BackgroundCreateCallback final
: public nsIIPCBackgroundChildCreateCallback
{
RefPtr<QuotaManagerService> mService;
public:
explicit
BackgroundCreateCallback(QuotaManagerService* aService)
: mService(aService)
{
MOZ_ASSERT(aService);
}
NS_DECL_ISUPPORTS
private:
~BackgroundCreateCallback()
{ }
NS_DECL_NSIIPCBACKGROUNDCHILDCREATECALLBACK
};
class QuotaManagerService::PendingRequestInfo
{
protected:
@ -352,95 +329,34 @@ QuotaManagerService::InitiateRequest(nsAutoPtr<PendingRequestInfo>& aInfo)
return NS_ERROR_FAILURE;
}
if (!mBackgroundActor && mPendingRequests.IsEmpty()) {
if (PBackgroundChild* actor = BackgroundChild::GetForCurrentThread()) {
BackgroundActorCreated(actor);
} else {
// We need to start the sequence to create a background actor for this
// thread.
RefPtr<BackgroundCreateCallback> cb = new BackgroundCreateCallback(this);
if (NS_WARN_IF(!BackgroundChild::GetOrCreateForCurrentThread(cb))) {
return NS_ERROR_FAILURE;
}
if (!mBackgroundActor) {
PBackgroundChild* backgroundActor =
BackgroundChild::GetOrCreateForCurrentThread();
if (NS_WARN_IF(!backgroundActor)) {
mBackgroundActorFailed = true;
return NS_ERROR_FAILURE;
}
{
QuotaChild* actor = new QuotaChild(this);
mBackgroundActor =
static_cast<QuotaChild*>(backgroundActor->SendPQuotaConstructor(actor));
}
}
// If we already have a background actor then we can start this request now.
if (mBackgroundActor) {
nsresult rv = aInfo->InitiateRequest(mBackgroundActor);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
} else {
mPendingRequests.AppendElement(aInfo.forget());
}
return NS_OK;
}
nsresult
QuotaManagerService::BackgroundActorCreated(PBackgroundChild* aBackgroundActor)
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(aBackgroundActor);
MOZ_ASSERT(!mBackgroundActor);
MOZ_ASSERT(!mBackgroundActorFailed);
{
QuotaChild* actor = new QuotaChild(this);
mBackgroundActor =
static_cast<QuotaChild*>(aBackgroundActor->SendPQuotaConstructor(actor));
}
if (NS_WARN_IF(!mBackgroundActor)) {
BackgroundActorFailed();
if (!mBackgroundActor) {
mBackgroundActorFailed = true;
return NS_ERROR_FAILURE;
}
nsresult rv = NS_OK;
for (uint32_t index = 0, count = mPendingRequests.Length();
index < count;
index++) {
nsAutoPtr<PendingRequestInfo> info(mPendingRequests[index].forget());
nsresult rv2 = info->InitiateRequest(mBackgroundActor);
// Warn for every failure, but just return the first failure if there are
// multiple failures.
if (NS_WARN_IF(NS_FAILED(rv2)) && NS_SUCCEEDED(rv)) {
rv = rv2;
}
// If we already have a background actor then we can start this request now.
nsresult rv = aInfo->InitiateRequest(mBackgroundActor);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
mPendingRequests.Clear();
return rv;
}
void
QuotaManagerService::BackgroundActorFailed()
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(!mPendingRequests.IsEmpty());
MOZ_ASSERT(!mBackgroundActor);
MOZ_ASSERT(!mBackgroundActorFailed);
mBackgroundActorFailed = true;
for (uint32_t index = 0, count = mPendingRequests.Length();
index < count;
index++) {
nsAutoPtr<PendingRequestInfo> info(mPendingRequests[index].forget());
RequestBase* request = info->GetRequest();
if (request) {
request->SetError(NS_ERROR_FAILURE);
}
}
mPendingRequests.Clear();
return NS_OK;
}
void
@ -895,36 +811,6 @@ AbortOperationsRunnable::Run()
return NS_OK;
}
NS_IMPL_ISUPPORTS(QuotaManagerService::BackgroundCreateCallback,
nsIIPCBackgroundChildCreateCallback)
void
QuotaManagerService::
BackgroundCreateCallback::ActorCreated(PBackgroundChild* aActor)
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(aActor);
MOZ_ASSERT(mService);
RefPtr<QuotaManagerService> service;
mService.swap(service);
service->BackgroundActorCreated(aActor);
}
void
QuotaManagerService::
BackgroundCreateCallback::ActorFailed()
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(mService);
RefPtr<QuotaManagerService> service;
mService.swap(service);
service->BackgroundActorFailed();
}
nsresult
QuotaManagerService::
UsageRequestInfo::InitiateRequest(QuotaChild* aActor)

View File

@ -49,8 +49,6 @@ class QuotaManagerService final
nsCOMPtr<nsIEventTarget> mBackgroundThread;
nsTArray<nsAutoPtr<PendingRequestInfo>> mPendingRequests;
QuotaChild* mBackgroundActor;
bool mBackgroundActorFailed;

View File

@ -1,15 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg">
<script>//<![CDATA[
function add_watch()
{
document.getElementById("p").transform.baseVal.watch("0", function(){});
}
window.addEventListener("load", add_watch, false);
//]]></script>
<path id="p" transform="scale(1)" />
</svg>

Before

Width:  |  Height:  |  Size: 297 B

View File

@ -1,15 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg">
<script>//<![CDATA[
function add_watch()
{
document.getElementById("e").x.baseVal.watch("0", function(){});
}
window.addEventListener("load", add_watch, false);
//]]></script>
<text id="e" x="10">foo</text>
</svg>

Before

Width:  |  Height:  |  Size: 283 B

View File

@ -1,15 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg">
<script>//<![CDATA[
function add_watch()
{
document.getElementById("e").rotate.baseVal.watch("0", function(){});
}
window.addEventListener("load", add_watch, false);
//]]></script>
<text id="e" rotate="10">foo</text>
</svg>

Before

Width:  |  Height:  |  Size: 293 B

View File

@ -1,15 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg">
<script>//<![CDATA[
function add_watch()
{
document.getElementById("e").pathSegList.watch("0", function(){});
}
window.addEventListener("load", add_watch, false);
//]]></script>
<path id="e" d="M0,0"/>
</svg>

Before

Width:  |  Height:  |  Size: 278 B

View File

@ -1,15 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg">
<script>//<![CDATA[
function add_watch()
{
document.getElementById("e").points.watch("0", function(){});
}
window.addEventListener("load", add_watch, false);
//]]></script>
<polygon id="e" points="0,0"/>
</svg>

Before

Width:  |  Height:  |  Size: 280 B

View File

@ -66,11 +66,6 @@ load 837450-1.svg
load 842463-1.html
load 847138-1.svg
load 864509.svg
load 880544-1.svg
load 880544-2.svg
load 880544-3.svg
load 880544-4.svg
load 880544-5.svg
load 898915-1.svg
load 1035248-1.svg
load 1035248-2.svg

View File

@ -1,14 +0,0 @@
<html>
<head>
<title>Iframe test for bug 38959</title>
</head>
<body">
<script>
x = false;
window.opener.postMessage(1, "http://mochi.test:8888");
window.close();
</script>
</body>
</html>

View File

@ -1,14 +0,0 @@
<html>
<head>
<title>Iframe test for bug 38959</title>
</head>
<body">
<script>
x = true;
window.opener.postMessage(2, "http://mochi.test:8888");
window.close();
</script>
</body>
</html>

View File

@ -21,8 +21,6 @@ support-files =
grandchild_bug260264.html
iframe_bug304459-1.html
iframe_bug304459-2.html
iframe_bug38959-1.html
iframe_bug38959-2.html
iframe_bug430276-2.html
iframe_bug430276.html
iframe_bug440572.html
@ -66,7 +64,6 @@ skip-if = toolkit == 'android' #TIMED_OUT
[test_bug377539.html]
[test_bug384122.html]
[test_bug389366.html]
[test_bug38959.html]
[test_bug393974.html]
[test_bug394769.html]
[test_bug396843.html]

View File

@ -1,57 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=38959
-->
<head>
<title>Test for Bug 38959</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=38959">Mozilla Bug 38959</a>
<p id="display"></p>
<div id="content" style="display: none">
<iframe id="frame"></iframe>
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 38959 **/
var newValue;
function watcher(id, ol, ne)
{
newValue = ne;
return ne;
}
function openWindow(url, crossOrigin)
{
newValue = true;
var w = window.open(url);
w.watch("x", watcher);
}
function receiveMessage(evt)
{
ok(newValue, "Watchpoints only allowed same-origin.");
if (evt.data == 1) {
openWindow("/tests/dom/tests/mochitest/bugs/iframe_bug38959-2.html");
}
else {
SimpleTest.finish();
}
}
SimpleTest.waitForExplicitFinish();
window.addEventListener("message", receiveMessage);
openWindow("http://example.org/tests/dom/tests/mochitest/bugs/iframe_bug38959-1.html");
</script>
</pre>
</body>
</html>

View File

@ -33,8 +33,7 @@ static mozilla::LazyLogModule gU2FManagerLog("u2fmanager");
NS_NAMED_LITERAL_STRING(kVisibilityChange, "visibilitychange");
NS_IMPL_ISUPPORTS(U2FManager, nsIIPCBackgroundChildCreateCallback,
nsIDOMEventListener);
NS_IMPL_ISUPPORTS(U2FManager, nsIDOMEventListener);
/***********************************************************************
* Utility Functions
@ -143,25 +142,30 @@ U2FManager::~U2FManager()
}
}
RefPtr<U2FManager::BackgroundActorPromise>
void
U2FManager::GetOrCreateBackgroundActor()
{
MOZ_ASSERT(NS_IsMainThread());
PBackgroundChild *actor = BackgroundChild::GetForCurrentThread();
RefPtr<U2FManager::BackgroundActorPromise> promise =
mPBackgroundCreationPromise.Ensure(__func__);
if (actor) {
ActorCreated(actor);
} else {
bool ok = BackgroundChild::GetOrCreateForCurrentThread(this);
if (NS_WARN_IF(!ok)) {
ActorFailed();
}
if (mChild) {
return;
}
return promise;
PBackgroundChild* actorChild = BackgroundChild::GetOrCreateForCurrentThread();
if (NS_WARN_IF(!actorChild)) {
MOZ_CRASH("Failed to create a PBackgroundChild actor!");
}
RefPtr<U2FTransactionChild> mgr(new U2FTransactionChild());
PWebAuthnTransactionChild* constructedMgr =
actorChild->SendPWebAuthnTransactionConstructor(mgr);
if (NS_WARN_IF(!constructedMgr)) {
return;
}
MOZ_ASSERT(constructedMgr == mgr);
mChild = mgr.forget();
}
//static
@ -259,19 +263,6 @@ U2FManager::Register(nsPIDOMWindowInner* aParent, const nsCString& aRpId,
return U2FPromise::CreateAndReject(ErrorCode::OTHER_ERROR, __func__).forget();
}
RefPtr<MozPromise<nsresult, nsresult, false>> p = GetOrCreateBackgroundActor();
p->Then(GetMainThreadSerialEventTarget(), __func__,
[]() {
U2FManager* mgr = U2FManager::Get();
if (mgr && mgr->mChild && mgr->mTransaction.isSome()) {
mgr->mChild->SendRequestRegister(mgr->mTransaction.ref().mInfo);
}
},
[]() {
// This case can't actually happen, we'll have crashed if the child
// failed to create.
});
ListenForVisibilityEvents(aParent, this);
// Always blank for U2F
@ -284,7 +275,15 @@ U2FManager::Register(nsPIDOMWindowInner* aParent, const nsCString& aRpId,
extensions);
MOZ_ASSERT(mTransaction.isNothing());
mTransaction = Some(U2FTransaction(aParent, Move(info), aClientDataJSON));
GetOrCreateBackgroundActor();
if (mChild) {
mChild->SendRequestRegister(mTransaction.ref().mInfo);
}
return mTransaction.ref().mPromise.Ensure(__func__);
}
@ -308,19 +307,6 @@ U2FManager::Sign(nsPIDOMWindowInner* aParent,
return U2FPromise::CreateAndReject(ErrorCode::OTHER_ERROR, __func__).forget();
}
RefPtr<MozPromise<nsresult, nsresult, false>> p = GetOrCreateBackgroundActor();
p->Then(GetMainThreadSerialEventTarget(), __func__,
[]() {
U2FManager* mgr = U2FManager::Get();
if (mgr && mgr->mChild && mgr->mTransaction.isSome()) {
mgr->mChild->SendRequestSign(mgr->mTransaction.ref().mInfo);
}
},
[]() {
// This case can't actually happen, we'll have crashed if the child
// failed to create.
});
ListenForVisibilityEvents(aParent, this);
// Always blank for U2F
@ -334,6 +320,13 @@ U2FManager::Sign(nsPIDOMWindowInner* aParent,
MOZ_ASSERT(mTransaction.isNothing());
mTransaction = Some(U2FTransaction(aParent, Move(info), aClientDataJSON));
GetOrCreateBackgroundActor();
if (mChild) {
mChild->SendRequestSign(mTransaction.ref().mInfo);
}
return mTransaction.ref().mPromise.Ensure(__func__);
}
@ -483,40 +476,11 @@ U2FManager::HandleEvent(nsIDOMEvent* aEvent)
return NS_OK;
}
void
U2FManager::ActorCreated(PBackgroundChild* aActor)
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(aActor);
if (mChild) {
return;
}
RefPtr<U2FTransactionChild> mgr(new U2FTransactionChild());
PWebAuthnTransactionChild* constructedMgr =
aActor->SendPWebAuthnTransactionConstructor(mgr);
if (NS_WARN_IF(!constructedMgr)) {
ActorFailed();
return;
}
MOZ_ASSERT(constructedMgr == mgr);
mChild = mgr.forget();
mPBackgroundCreationPromise.Resolve(NS_OK, __func__);
}
void
U2FManager::ActorDestroyed()
{
mChild = nullptr;
}
void
U2FManager::ActorFailed()
{
MOZ_CRASH("We shouldn't be here!");
}
} // namespace dom
} // namespace mozilla

View File

@ -12,7 +12,6 @@
#include "mozilla/dom/Event.h"
#include "mozilla/dom/PWebAuthnTransaction.h"
#include "nsIDOMEventListener.h"
#include "nsIIPCBackgroundChildCreateCallback.h"
/*
* Content process manager for the U2F protocol. Created on calls to the
@ -78,13 +77,11 @@ public:
nsCString mClientData;
};
class U2FManager final : public nsIIPCBackgroundChildCreateCallback
, public nsIDOMEventListener
class U2FManager final : public nsIDOMEventListener
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIDOMEVENTLISTENER
NS_DECL_NSIIPCBACKGROUNDCHILDCREATECALLBACK
static U2FManager* GetOrCreate();
static U2FManager* Get();
@ -134,16 +131,13 @@ private:
typedef MozPromise<nsresult, nsresult, false> BackgroundActorPromise;
RefPtr<BackgroundActorPromise> GetOrCreateBackgroundActor();
void GetOrCreateBackgroundActor();
// IPC Channel for the current transaction.
RefPtr<U2FTransactionChild> mChild;
// The current transaction, if any.
Maybe<U2FTransaction> mTransaction;
// Promise for dealing with PBackground Actor creation.
MozPromiseHolder<BackgroundActorPromise> mPBackgroundCreationPromise;
};
} // namespace dom

View File

@ -46,8 +46,7 @@ static mozilla::LazyLogModule gWebAuthnManagerLog("webauthnmanager");
NS_NAMED_LITERAL_STRING(kVisibilityChange, "visibilitychange");
NS_IMPL_ISUPPORTS(WebAuthnManager, nsIIPCBackgroundChildCreateCallback,
nsIDOMEventListener);
NS_IMPL_ISUPPORTS(WebAuthnManager, nsIDOMEventListener);
/***********************************************************************
* Utility Functions
@ -237,25 +236,31 @@ WebAuthnManager::~WebAuthnManager()
}
}
RefPtr<WebAuthnManager::BackgroundActorPromise>
void
WebAuthnManager::GetOrCreateBackgroundActor()
{
MOZ_ASSERT(NS_IsMainThread());
PBackgroundChild *actor = BackgroundChild::GetForCurrentThread();
RefPtr<WebAuthnManager::BackgroundActorPromise> promise =
mPBackgroundCreationPromise.Ensure(__func__);
if (actor) {
ActorCreated(actor);
} else {
bool ok = BackgroundChild::GetOrCreateForCurrentThread(this);
if (NS_WARN_IF(!ok)) {
ActorFailed();
}
if (mChild) {
return;
}
return promise;
PBackgroundChild* actor = BackgroundChild::GetOrCreateForCurrentThread();
if (NS_WARN_IF(!actor)) {
MOZ_CRASH("Failed to create a PBackgroundChild actor!");
}
RefPtr<WebAuthnTransactionChild> mgr(new WebAuthnTransactionChild());
PWebAuthnTransactionChild* constructedMgr =
actor->SendPWebAuthnTransactionConstructor(mgr);
if (NS_WARN_IF(!constructedMgr)) {
MOZ_CRASH("Failed to create a PBackgroundChild actor!");
return;
}
MOZ_ASSERT(constructedMgr == mgr);
mChild = mgr.forget();
}
//static
@ -461,18 +466,6 @@ WebAuthnManager::MakeCredential(nsPIDOMWindowInner* aParent,
adjustedTimeout,
excludeList,
extensions);
RefPtr<MozPromise<nsresult, nsresult, false>> p = GetOrCreateBackgroundActor();
p->Then(GetMainThreadSerialEventTarget(), __func__,
[]() {
WebAuthnManager* mgr = WebAuthnManager::Get();
if (mgr && mgr->mChild && mgr->mTransaction.isSome()) {
mgr->mChild->SendRequestRegister(mgr->mTransaction.ref().mInfo);
}
},
[]() {
// This case can't actually happen, we'll have crashed if the child
// failed to create.
});
ListenForVisibilityEvents(aParent, this);
@ -482,6 +475,11 @@ WebAuthnManager::MakeCredential(nsPIDOMWindowInner* aParent,
Move(info),
Move(clientDataJSON)));
GetOrCreateBackgroundActor();
if (mChild) {
mChild->SendRequestRegister(mTransaction.ref().mInfo);
}
return promise.forget();
}
@ -616,18 +614,6 @@ WebAuthnManager::GetAssertion(nsPIDOMWindowInner* aParent,
adjustedTimeout,
allowList,
extensions);
RefPtr<MozPromise<nsresult, nsresult, false>> p = GetOrCreateBackgroundActor();
p->Then(GetMainThreadSerialEventTarget(), __func__,
[]() {
WebAuthnManager* mgr = WebAuthnManager::Get();
if (mgr && mgr->mChild && mgr->mTransaction.isSome()) {
mgr->mChild->SendRequestSign(mgr->mTransaction.ref().mInfo);
}
},
[]() {
// This case can't actually happen, we'll have crashed if the child
// failed to create.
});
ListenForVisibilityEvents(aParent, this);
@ -637,6 +623,11 @@ WebAuthnManager::GetAssertion(nsPIDOMWindowInner* aParent,
Move(info),
Move(clientDataJSON)));
GetOrCreateBackgroundActor();
if (mChild) {
mChild->SendRequestSign(mTransaction.ref().mInfo);
}
return promise.forget();
}
@ -911,29 +902,6 @@ WebAuthnManager::HandleEvent(nsIDOMEvent* aEvent)
return NS_OK;
}
void
WebAuthnManager::ActorCreated(PBackgroundChild* aActor)
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(aActor);
if (mChild) {
return;
}
RefPtr<WebAuthnTransactionChild> mgr(new WebAuthnTransactionChild());
PWebAuthnTransactionChild* constructedMgr =
aActor->SendPWebAuthnTransactionConstructor(mgr);
if (NS_WARN_IF(!constructedMgr)) {
ActorFailed();
return;
}
MOZ_ASSERT(constructedMgr == mgr);
mChild = mgr.forget();
mPBackgroundCreationPromise.Resolve(NS_OK, __func__);
}
void
WebAuthnManager::ActorDestroyed()
{
@ -941,12 +909,5 @@ WebAuthnManager::ActorDestroyed()
mChild = nullptr;
}
void
WebAuthnManager::ActorFailed()
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_CRASH("We shouldn't be here!");
}
}
}

View File

@ -11,7 +11,6 @@
#include "mozilla/dom/Event.h"
#include "mozilla/dom/PWebAuthnTransaction.h"
#include "nsIDOMEventListener.h"
#include "nsIIPCBackgroundChildCreateCallback.h"
/*
* Content process manager for the WebAuthn protocol. Created on calls to the
@ -88,13 +87,11 @@ public:
nsCString mClientData;
};
class WebAuthnManager final : public nsIIPCBackgroundChildCreateCallback,
public nsIDOMEventListener
class WebAuthnManager final : public nsIDOMEventListener
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIDOMEVENTLISTENER
NS_DECL_NSIIPCBACKGROUNDCHILDCREATECALLBACK
static WebAuthnManager* GetOrCreate();
static WebAuthnManager* Get();
@ -136,16 +133,13 @@ private:
typedef MozPromise<nsresult, nsresult, false> BackgroundActorPromise;
RefPtr<BackgroundActorPromise> GetOrCreateBackgroundActor();
void GetOrCreateBackgroundActor();
// IPC Channel for the current transaction.
RefPtr<WebAuthnTransactionChild> mChild;
// The current transaction, if any.
Maybe<WebAuthnTransaction> mTransaction;
// Promise for dealing with PBackground Actor creation.
MozPromiseHolder<BackgroundActorPromise> mPBackgroundCreationPromise;
};
} // namespace dom

View File

@ -2322,8 +2322,9 @@ nsWebBrowserPersist::MakeOutputStreamFromFile(
rv = fileOutputStream->Init(aFile, ioFlags, -1, 0);
NS_ENSURE_SUCCESS(rv, rv);
*aOutputStream = NS_BufferOutputStream(fileOutputStream,
BUFFERED_OUTPUT_SIZE).take();
rv = NS_NewBufferedOutputStream(aOutputStream, fileOutputStream.forget(),
BUFFERED_OUTPUT_SIZE);
NS_ENSURE_SUCCESS(rv, rv);
if (mPersistFlags & PERSIST_FLAGS_CLEANUP_ON_FAILURE)
{

View File

@ -54,7 +54,6 @@
#include "nsContentUtils.h"
#include "nsCycleCollector.h"
#include "nsDOMJSUtils.h"
#include "nsIIPCBackgroundChildCreateCallback.h"
#include "nsISupportsImpl.h"
#include "nsLayoutStatics.h"
#include "nsNetUtil.h"
@ -1307,40 +1306,6 @@ PlatformOverrideChanged(const char* /* aPrefName */, void* /* aClosure */)
}
}
class BackgroundChildCallback final
: public nsIIPCBackgroundChildCreateCallback
{
public:
BackgroundChildCallback()
{
AssertIsOnMainThread();
}
NS_DECL_ISUPPORTS
private:
~BackgroundChildCallback()
{
AssertIsOnMainThread();
}
virtual void
ActorCreated(PBackgroundChild* aActor) override
{
AssertIsOnMainThread();
MOZ_ASSERT(aActor);
}
virtual void
ActorFailed() override
{
AssertIsOnMainThread();
MOZ_CRASH("Unable to connect PBackground actor for the main thread!");
}
};
NS_IMPL_ISUPPORTS(BackgroundChildCallback, nsIIPCBackgroundChildCreateCallback)
} /* anonymous namespace */
BEGIN_WORKERS_NAMESPACE
@ -1953,15 +1918,6 @@ RuntimeService::Init()
nsLayoutStatics::AddRef();
// Make sure PBackground actors are connected as soon as possible for the main
// thread in case workers clone remote blobs here.
if (!BackgroundChild::GetForCurrentThread()) {
RefPtr<BackgroundChildCallback> callback = new BackgroundChildCallback();
if (!BackgroundChild::GetOrCreateForCurrentThread(callback)) {
MOZ_CRASH("Unable to connect PBackground actor for the main thread!");
}
}
// Initialize JSSettings.
if (sDefaultJSSettings.gcSettings[0].key.isNothing()) {
sDefaultJSSettings.contextOptions = JS::ContextOptions();

View File

@ -106,11 +106,6 @@ ServiceWorkerJob::Start(Callback* aFinalCallback)
// browser shutdown
return;
}
if (!swm->HasBackgroundActor()) {
// waiting to initialize
swm->AppendPendingOperation(runnable);
return;
}
// Otherwise start asynchronously. We should never run a job synchronously.
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(

View File

@ -250,7 +250,6 @@ NS_IMPL_RELEASE(ServiceWorkerManager)
NS_INTERFACE_MAP_BEGIN(ServiceWorkerManager)
NS_INTERFACE_MAP_ENTRY(nsIServiceWorkerManager)
NS_INTERFACE_MAP_ENTRY(nsIIPCBackgroundChildCreateCallback)
NS_INTERFACE_MAP_ENTRY(nsIObserver)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIServiceWorkerManager)
NS_INTERFACE_MAP_END
@ -296,11 +295,20 @@ ServiceWorkerManager::Init(ServiceWorkerRegistrar* aRegistrar)
}
}
if (!BackgroundChild::GetOrCreateForCurrentThread(this)) {
// Make sure to do this last as our failure cleanup expects Init() to have
// executed.
ActorFailed();
PBackgroundChild* actorChild = BackgroundChild::GetOrCreateForCurrentThread();
if (NS_WARN_IF(!actorChild)) {
MaybeStartShutdown();
return;
}
PServiceWorkerManagerChild* actor =
actorChild->SendPServiceWorkerManagerConstructor();
if (!actor) {
MaybeStartShutdown();
return;
}
mActor = static_cast<ServiceWorkerManagerChild*>(actor);
}
void
@ -339,8 +347,6 @@ ServiceWorkerManager::MaybeStartShutdown()
}
}
mPendingOperations.Clear();
if (!mActor) {
return;
}
@ -426,120 +432,6 @@ private:
const nsString mScope;
};
class PropagateUnregisterRunnable final : public Runnable
{
public:
PropagateUnregisterRunnable(nsIPrincipal* aPrincipal,
nsIServiceWorkerUnregisterCallback* aCallback,
const nsAString& aScope)
: Runnable("dom::workers::PropagateUnregisterRunnable")
, mPrincipal(aPrincipal)
, mCallback(aCallback)
, mScope(aScope)
{
MOZ_ASSERT(aPrincipal);
}
NS_IMETHOD Run() override
{
AssertIsOnMainThread();
RefPtr<ServiceWorkerManager> swm = ServiceWorkerManager::GetInstance();
if (swm) {
swm->PropagateUnregister(mPrincipal, mCallback, mScope);
}
return NS_OK;
}
private:
~PropagateUnregisterRunnable()
{}
nsCOMPtr<nsIPrincipal> mPrincipal;
nsCOMPtr<nsIServiceWorkerUnregisterCallback> mCallback;
const nsString mScope;
};
class RemoveRunnable final : public Runnable
{
public:
explicit RemoveRunnable(const nsACString& aHost)
: Runnable("dom::workers::RemoveRunnable")
{
}
NS_IMETHOD Run() override
{
AssertIsOnMainThread();
RefPtr<ServiceWorkerManager> swm = ServiceWorkerManager::GetInstance();
if (swm) {
swm->Remove(mHost);
}
return NS_OK;
}
private:
~RemoveRunnable()
{}
const nsCString mHost;
};
class PropagateRemoveRunnable final : public Runnable
{
public:
explicit PropagateRemoveRunnable(const nsACString& aHost)
: Runnable("dom::workers::PropagateRemoveRunnable")
{
}
NS_IMETHOD Run() override
{
AssertIsOnMainThread();
RefPtr<ServiceWorkerManager> swm = ServiceWorkerManager::GetInstance();
if (swm) {
swm->PropagateRemove(mHost);
}
return NS_OK;
}
private:
~PropagateRemoveRunnable()
{}
const nsCString mHost;
};
class PropagateRemoveAllRunnable final : public Runnable
{
public:
PropagateRemoveAllRunnable()
: Runnable("dom::workers::PropagateRemoveAllRunnable")
{
}
NS_IMETHOD Run() override
{
AssertIsOnMainThread();
RefPtr<ServiceWorkerManager> swm = ServiceWorkerManager::GetInstance();
if (swm) {
swm->PropagateRemoveAll();
}
return NS_OK;
}
private:
~PropagateRemoveAllRunnable()
{}
};
class PromiseResolverCallback final : public ServiceWorkerUpdateFinishCallback
{
public:
@ -964,17 +856,6 @@ ServiceWorkerManager::Register(mozIDOMWindow* aWindow,
return NS_OK;
}
void
ServiceWorkerManager::AppendPendingOperation(nsIRunnable* aRunnable)
{
MOZ_ASSERT(!mActor);
MOZ_ASSERT(aRunnable);
if (!mShuttingDown) {
mPendingOperations.AppendElement(aRunnable);
}
}
/*
* Implements the async aspects of the getRegistrations algorithm.
*/
@ -2109,45 +1990,6 @@ ServiceWorkerManager::LoadRegistrations(
}
}
void
ServiceWorkerManager::ActorFailed()
{
MOZ_DIAGNOSTIC_ASSERT(!mActor);
MaybeStartShutdown();
}
void
ServiceWorkerManager::ActorCreated(mozilla::ipc::PBackgroundChild* aActor)
{
MOZ_ASSERT(aActor);
MOZ_ASSERT(!mActor);
if (mShuttingDown) {
MOZ_DIAGNOSTIC_ASSERT(mPendingOperations.IsEmpty());
return;
}
PServiceWorkerManagerChild* actor =
aActor->SendPServiceWorkerManagerConstructor();
if (!actor) {
ActorFailed();
return;
}
mActor = static_cast<ServiceWorkerManagerChild*>(actor);
// Flush the pending requests.
for (uint32_t i = 0, len = mPendingOperations.Length(); i < len; ++i) {
MOZ_ASSERT(mPendingOperations[i]);
nsresult rv = NS_DispatchToCurrentThread(mPendingOperations[i].forget());
if (NS_FAILED(rv)) {
NS_WARNING("Failed to dispatch a runnable.");
}
}
mPendingOperations.Clear();
}
void
ServiceWorkerManager::StoreRegistration(
nsIPrincipal* aPrincipal,
@ -2160,11 +2002,6 @@ ServiceWorkerManager::StoreRegistration(
return;
}
MOZ_DIAGNOSTIC_ASSERT(mActor);
if (!mActor) {
return;
}
ServiceWorkerRegistrationData data;
nsresult rv = PopulateRegistrationData(aPrincipal, aRegistration, data);
if (NS_WARN_IF(NS_FAILED(rv))) {
@ -3038,13 +2875,6 @@ ServiceWorkerManager::SoftUpdate(const OriginAttributes& aOriginAttributes,
return;
}
if (!mActor) {
RefPtr<Runnable> runnable =
new SoftUpdateRunnable(aOriginAttributes, aScope, false, nullptr);
AppendPendingOperation(runnable);
return;
}
RefPtr<GenericPromise::Private> promise =
new GenericPromise::Private(__func__);
@ -3179,14 +3009,6 @@ ServiceWorkerManager::Update(nsIPrincipal* aPrincipal,
{
AssertIsOnMainThread();
if (!mActor) {
RefPtr<Runnable> runnable =
new UpdateRunnable(aPrincipal, aScope, aCallback,
UpdateRunnable::ePostpone, nullptr);
AppendPendingOperation(runnable);
return;
}
RefPtr<GenericPromise::Private> promise =
new GenericPromise::Private(__func__);
@ -3778,14 +3600,6 @@ ServiceWorkerManager::Remove(const nsACString& aHost)
{
AssertIsOnMainThread();
// We need to postpone this operation in case we don't have an actor because
// this is needed by the ForceUnregister.
if (!mActor) {
RefPtr<nsIRunnable> runnable = new RemoveRunnable(aHost);
AppendPendingOperation(runnable);
return;
}
for (auto it1 = mRegistrationInfos.Iter(); !it1.Done(); it1.Next()) {
ServiceWorkerManager::RegistrationDataPerPrincipal* data = it1.UserData();
for (auto it2 = data->mInfos.Iter(); !it2.Done(); it2.Next()) {
@ -3805,13 +3619,6 @@ void
ServiceWorkerManager::PropagateRemove(const nsACString& aHost)
{
AssertIsOnMainThread();
if (!mActor) {
RefPtr<nsIRunnable> runnable = new PropagateRemoveRunnable(aHost);
AppendPendingOperation(runnable);
return;
}
mActor->SendPropagateRemove(nsCString(aHost));
}
@ -3834,13 +3641,6 @@ ServiceWorkerManager::PropagateRemoveAll()
{
AssertIsOnMainThread();
MOZ_ASSERT(XRE_IsParentProcess());
if (!mActor) {
RefPtr<nsIRunnable> runnable = new PropagateRemoveAllRunnable();
AppendPendingOperation(runnable);
return;
}
mActor->SendPropagateRemoveAll();
}
@ -4078,14 +3878,6 @@ ServiceWorkerManager::PropagateSoftUpdate(const OriginAttributes& aOriginAttribu
const nsAString& aScope)
{
AssertIsOnMainThread();
if (!mActor) {
RefPtr<nsIRunnable> runnable =
new PropagateSoftUpdateRunnable(aOriginAttributes, aScope);
AppendPendingOperation(runnable);
return;
}
mActor->SendPropagateSoftUpdate(aOriginAttributes, nsString(aScope));
}
@ -4097,13 +3889,6 @@ ServiceWorkerManager::PropagateUnregister(nsIPrincipal* aPrincipal,
AssertIsOnMainThread();
MOZ_ASSERT(aPrincipal);
if (!mActor) {
RefPtr<nsIRunnable> runnable =
new PropagateUnregisterRunnable(aPrincipal, aCallback, aScope);
AppendPendingOperation(runnable);
return NS_OK;
}
PrincipalInfo principalInfo;
if (NS_WARN_IF(NS_FAILED(PrincipalToPrincipalInfo(aPrincipal,
&principalInfo)))) {

View File

@ -28,7 +28,6 @@
#include "mozilla/ipc/BackgroundUtils.h"
#include "nsClassHashtable.h"
#include "nsDataHashtable.h"
#include "nsIIPCBackgroundChildCreateCallback.h"
#include "nsRefPtrHashtable.h"
#include "nsTArrayForwardDeclare.h"
#include "nsTObserverArray.h"
@ -83,7 +82,6 @@ public:
*/
class ServiceWorkerManager final
: public nsIServiceWorkerManager
, public nsIIPCBackgroundChildCreateCallback
, public nsIObserver
{
friend class GetReadyPromiseRunnable;
@ -98,7 +96,6 @@ class ServiceWorkerManager final
public:
NS_DECL_ISUPPORTS
NS_DECL_NSISERVICEWORKERMANAGER
NS_DECL_NSIIPCBACKGROUNDCHILDCREATECALLBACK
NS_DECL_NSIOBSERVER
struct RegistrationDataPerPrincipal;
@ -463,13 +460,6 @@ private:
RefPtr<Promise> mPromise;
};
void AppendPendingOperation(nsIRunnable* aRunnable);
bool HasBackgroundActor() const
{
return !!mActor;
}
nsClassHashtable<nsISupportsHashKey, PendingReadyPromise> mPendingReadyPromises;
void
@ -481,8 +471,6 @@ private:
RefPtr<ServiceWorkerManagerChild> mActor;
nsTArray<nsCOMPtr<nsIRunnable>> mPendingOperations;
bool mShuttingDown;
nsTArray<nsCOMPtr<nsIServiceWorkerManagerListener>> mListeners;

View File

@ -100,12 +100,13 @@ public:
bool aIsMainScript)
: mManager(aManager)
, mRegistration(aRegistration)
, mIsMainScript(aIsMainScript)
, mInternalHeaders(new InternalHeaders())
, mLoadFlags(nsIChannel::LOAD_BYPASS_SERVICE_WORKER)
, mState(WaitingForInitialization)
, mNetworkResult(NS_OK)
, mCacheResult(NS_OK)
, mIsMainScript(aIsMainScript)
, mIsFromCache(false)
{
MOZ_ASSERT(aManager);
AssertIsOnMainThread();
@ -180,8 +181,6 @@ private:
RefPtr<CompareCache> mCC;
RefPtr<ServiceWorkerRegistrationInfo> mRegistration;
bool mIsMainScript;
nsCOMPtr<nsIChannel> mChannel;
nsString mBuffer;
nsString mURL;
@ -202,6 +201,9 @@ private:
nsresult mNetworkResult;
nsresult mCacheResult;
const bool mIsMainScript;
bool mIsFromCache;
};
NS_IMPL_ISUPPORTS(CompareNetwork, nsIStreamLoaderObserver,
@ -863,6 +865,12 @@ CompareNetwork::OnStartRequest(nsIRequest* aRequest, nsISupports* aContext)
}
mInternalHeaders->FillResponseHeaders(mChannel);
nsCOMPtr<nsICacheInfoChannel> cacheChannel(do_QueryInterface(channel));
if (cacheChannel) {
cacheChannel->IsFromCache(&mIsFromCache);
}
return NS_OK;
}
@ -959,15 +967,9 @@ CompareNetwork::OnStreamComplete(nsIStreamLoader* aLoader, nsISupports* aContext
NS_LITERAL_CSTRING("Service-Worker-Allowed"),
mMaxScope);
bool isFromCache = false;
nsCOMPtr<nsICacheInfoChannel> cacheChannel(do_QueryInterface(httpChannel));
if (cacheChannel) {
cacheChannel->IsFromCache(&isFromCache);
}
// [9.2 Update]4.13, If response's cache state is not "local",
// set registration's last update check time to the current time
if (!isFromCache) {
if (!mIsFromCache) {
mRegistration->RefreshLastUpdateCheckTime();
}

View File

@ -13,6 +13,6 @@ support-files =
[browser_force_refresh.js]
[browser_download.js]
[browser_multie10s_update.js]
run-if=e10s
skip-if = !e10s || os != "win" # Bug 1404914
[browser_userContextId_openWindow.js]
run-if=e10s
skip-if = !e10s

View File

@ -232,6 +232,7 @@ support-files =
[test_cross_origin_url_after_redirect.html]
skip-if = debug # Bug 1262224
[test_csp_upgrade-insecure_intercept.html]
[test_devtools_bypass_serviceworker.html]
[test_empty_serviceworker.html]
[test_error_reporting.html]
[test_escapedSlashes.html]

View File

@ -7,7 +7,8 @@
if (event.data !== "register") {
return;
}
var promise = navigator.serviceWorker.register("worker.js");
var promise = navigator.serviceWorker.register("worker.js",
{ updateViaCache: 'all' });
window.onmessage = function (event) {
if (event.data !== "unregister") {
return;

View File

@ -0,0 +1,118 @@
<!DOCTYPE HTML>
<html>
<head>
<title> Verify devtools can utilize nsIChannel::LOAD_BYPASS_SERVICE_WORKER to bypass the service worker </title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<script src="/tests/SimpleTest/SpawnTask.js"></script>
<script src="error_reporting_helpers.js"></script>
<link rel="stylesheet" href="/tests/SimpleTest/test.css"/>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
</head>
<body>
<div id="content" style="display: none"></div>
<script type="text/javascript">
"use strict";
async function testBypassSW () {
// Bypass SW imitates the "Disable Cache" option in dev-tools.
// Note: if we put the setter/getter into dev-tools, we should take care of
// the implementation of enabling/disabling cache since it just overwrite the
// defaultLoadFlags of docShell.
function setBypassServiceWorker(aDocShell, aBypass) {
if (aBypass) {
aDocShell.defaultLoadFlags |= Ci.nsIChannel.LOAD_BYPASS_SERVICE_WORKER;
return;
}
aDocShell.defaultLoadFlags &= ~Ci.nsIChannel.LOAD_BYPASS_SERVICE_WORKER;
}
function getBypassServiceWorker(aDocShell) {
return !!(aDocShell.defaultLoadFlags &
Ci.nsIChannel.LOAD_BYPASS_SERVICE_WORKER);
}
async function fetchFakeDocAndCheckIfIntercepted(aWindow) {
const fakeDoc = "fake.html";
// Note: The fetching document doesn't exist, so the expected status of the
// repsonse is 404 unless the request is hijacked.
let response = await aWindow.fetch(fakeDoc);
if (response.status === 404) {
return false;
} else if (!response.ok) {
throw(response.statusText);
}
let text = await response.text();
if (text.includes("Hello")) {
// Intercepted
return true;
}
throw("Unexpected error");
return;
}
let Ci = SpecialPowers.Ci;
let docShell = SpecialPowers.wrap(window)
.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShell);
info("Test 1: Enable bypass service worker for the docShell");
setBypassServiceWorker(docShell, true);
ok(getBypassServiceWorker(docShell),
"The loadFlags in docShell does bypass the serviceWorker by default");
let intercepted = await fetchFakeDocAndCheckIfIntercepted(window);
ok(!intercepted,
"The fetched document wasn't intercepted by the serviceWorker");
info("Test 2: Disable the bypass service worker for the docShell");
setBypassServiceWorker(docShell, false);
ok(!getBypassServiceWorker(docShell),
"The loadFlags in docShell doesn't bypass the serviceWorker by default");
intercepted = await fetchFakeDocAndCheckIfIntercepted(window);
ok(intercepted,
"The fetched document was intercepted by the serviceWorker");
}
// (This doesn't really need to be its own task, but it allows the actual test
// case to be self-contained.)
add_task(function setupPrefs() {
return SpecialPowers.pushPrefEnv({"set": [
["dom.serviceWorkers.enabled", true],
["dom.serviceWorkers.testing.enabled", true],
]});
});
add_task(async function test_bypassServiceWorker() {
const swURL = "fetch.js";
let registration = await navigator.serviceWorker.register(swURL);
// Wait for the service worker to control the document
let waitForControlled = new Promise(resolve => {
navigator.serviceWorker.oncontrollerchange = resolve;
});
let sw =
registration.active || registration.waiting || registration.installing;
sw.postMessage("claim");
await waitForControlled;
try {
await testBypassSW();
} catch (e) {
ok(false, "Reason:" + e);
}
await registration.unregister();
});
</script>
</body>
</html>

View File

@ -53,6 +53,8 @@ let expectedResults = [
state: State.ACTIVATED, installedTimeRecorded: true,
activatedTimeRecorded: true, redundantTimeRecorded: false
},
// On unregister
{
state: State.REDUNDANT, installedTimeRecorded: true,
activatedTimeRecorded: true, redundantTimeRecorded: true
@ -170,6 +172,15 @@ function testServiceWorkerInfo() {
return promise;
}
async function testHttpCacheUpdateTime() {
let iframe = document.querySelector("iframe");
let reg = await iframe.contentWindow.navigator.serviceWorker.getRegistration();
let lastUpdateTime = registrationInfo.lastUpdateTime;
await reg.update();
is(lastUpdateTime, registrationInfo.lastUpdateTime,
"The update time should not change when SW script is read from http cache.");
}
function unregister() {
info("Unregister the ServiceWorker");
@ -196,6 +207,7 @@ function runTest() {
return Promise.resolve()
.then(register)
.then(testServiceWorkerInfo)
.then(testHttpCacheUpdateTime)
.then(unregister)
.catch(aError => ok(false, "Some test failed with error " + aError))
.then(cleanAll)

View File

@ -5893,7 +5893,10 @@ HTMLEditRules::GetNodesForOperation(
// Then unregister the ranges
for (auto& item : rangeItemArray) {
htmlEditor->mRangeUpdater.DropRangeItem(item);
aArrayOfRanges.AppendElement(item->GetRange());
RefPtr<nsRange> range = item->GetRange();
if (range) {
aArrayOfRanges.AppendElement(range);
}
}
NS_ENSURE_SUCCESS(rv, rv);
}

View File

@ -0,0 +1,21 @@
<!DOCTYPE html>
<html class="reftest-wait">
<head>
<script>
function load() {
document.getElementById("p").addEventListener("DOMNodeInserted", () => {
document.getElementById("style").appendChild(
document.getElementById("table"));
document.documentElement.classList.remove("reftest-wait");
});
document.execCommand("insertOrderedList", false);
}
</script>
</head>
<body onload="load()">
<table id="table"></table>
<style id="style"></style>
<spacer id="spacer" contenteditable="true">
<p id="p"></p>
</body>
</html>

View File

@ -88,6 +88,7 @@ load 1383763.html
load 1384161.html
load 1388075.html
load 1393171.html
needs-focus load 1402196.html
load 1402469.html
load 1402904.html
load 1405747.html

View File

@ -105,7 +105,7 @@ public:
// Get a buffered output stream 4096 bytes big, to optimize writes.
nsCOMPtr<nsIOutputStream> bufferedOutputStream;
res = NS_NewBufferedOutputStream(getter_AddRefs(bufferedOutputStream),
outStream, 4096);
outStream.forget(), 4096);
if (NS_FAILED(res)) {
return res;
}

View File

@ -12,7 +12,6 @@
#include "mozilla/ipc/Transport.h"
class nsIDOMBlob;
class nsIIPCBackgroundChildCreateCallback;
namespace mozilla {
namespace dom {
@ -37,8 +36,6 @@ class PBackgroundChild;
// Creation of PBackground is synchronous. GetOrCreateForCurrentThread will
// create the actor if it doesn't exist yet. Thereafter (assuming success)
// GetForCurrentThread() will return the same actor every time.
// GetOrCreateForCurrentThread(nsIIPCBackgroundChildCreateCallback* aCallback)
// emulates former asynchronous behavior and might be removed in future.
//
// CloseForCurrentThread() will close the current PBackground actor. Subsequent
// calls to GetForCurrentThread will return null. CloseForCurrentThread() may
@ -60,10 +57,6 @@ public:
static PBackgroundChild*
GetForCurrentThread();
// See above.
static bool
GetOrCreateForCurrentThread(nsIIPCBackgroundChildCreateCallback* aCallback);
// See above.
static PBackgroundChild*
GetOrCreateForCurrentThread();

View File

@ -28,7 +28,6 @@
#include "nsAutoPtr.h"
#include "nsCOMPtr.h"
#include "nsIEventTarget.h"
#include "nsIIPCBackgroundChildCreateCallback.h"
#include "nsIMutable.h"
#include "nsIObserver.h"
#include "nsIObserverService.h"
@ -398,10 +397,6 @@ private:
static PBackgroundChild*
GetForCurrentThread();
// Forwarded from BackgroundChild.
static bool
GetOrCreateForCurrentThread(nsIIPCBackgroundChildCreateCallback* aCallback);
// Forwarded from BackgroundChild.
static PBackgroundChild*
GetOrCreateForCurrentThread();
@ -627,35 +622,6 @@ private:
}
};
// Must be cancelable in order to dispatch on active worker threads
class ChildImpl::ActorCreatedRunnable final :
public CancelableRunnable
{
nsCOMPtr<nsIIPCBackgroundChildCreateCallback> mCallback;
RefPtr<ChildImpl> mActor;
public:
ActorCreatedRunnable(nsIIPCBackgroundChildCreateCallback* aCallback,
ChildImpl* aActor)
: CancelableRunnable("Background::ChildImpl::ActorCreatedRunnable")
, mCallback(aCallback)
, mActor(aActor)
{
// May be created on any thread!
MOZ_ASSERT(aCallback);
MOZ_ASSERT(aActor);
}
protected:
virtual ~ActorCreatedRunnable()
{ }
NS_DECL_NSIRUNNABLE
nsresult
Cancel() override;
};
} // namespace
namespace mozilla {
@ -748,14 +714,6 @@ BackgroundChild::GetForCurrentThread()
return ChildImpl::GetForCurrentThread();
}
// static
bool
BackgroundChild::GetOrCreateForCurrentThread(
nsIIPCBackgroundChildCreateCallback* aCallback)
{
return ChildImpl::GetOrCreateForCurrentThread(aCallback);
}
// static
PBackgroundChild*
BackgroundChild::GetOrCreateForCurrentThread()
@ -1488,25 +1446,6 @@ ChildImpl::GetForCurrentThread()
return threadLocalInfo->mActor;
}
// static
bool
ChildImpl::GetOrCreateForCurrentThread(
nsIIPCBackgroundChildCreateCallback* aCallback)
{
MOZ_ASSERT(aCallback);
RefPtr<ChildImpl> actor =
static_cast<ChildImpl*>(GetOrCreateForCurrentThread());
if (NS_WARN_IF(!actor)) {
return false;
}
nsCOMPtr<nsIRunnable> runnable = new ActorCreatedRunnable(aCallback, actor);
MOZ_ALWAYS_SUCCEEDS(NS_DispatchToCurrentThread(runnable));
return true;
}
/* static */
PBackgroundChild*
ChildImpl::GetOrCreateForCurrentThread()
@ -1649,27 +1588,6 @@ ChildImpl::GetThreadLocalForCurrentThread()
return threadLocalInfo->mConsumerThreadLocal;
}
NS_IMETHODIMP
ChildImpl::ActorCreatedRunnable::Run()
{
// May run on any thread!
MOZ_ASSERT(mCallback);
MOZ_ASSERT(mActor);
mCallback->ActorCreated(mActor);
return NS_OK;
}
nsresult
ChildImpl::ActorCreatedRunnable::Cancel()
{
// These are IPC infrastructure objects and need to run unconditionally.
Run();
return NS_OK;
}
void
ChildImpl::ActorDestroy(ActorDestroyReason aWhy)
{

View File

@ -6,7 +6,6 @@
include('/media/webrtc/webrtc.mozbuild')
EXPORTS += [
'nsIIPCBackgroundChildCreateCallback.h',
'nsIIPCSerializableInputStream.h',
'nsIIPCSerializableURI.h',
]

View File

@ -1,72 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_ipc_nsiipcbackgroundchildcreatecallback_h
#define mozilla_ipc_nsiipcbackgroundchildcreatecallback_h
#include "mozilla/Attributes.h"
#include "nsISupports.h"
namespace mozilla {
namespace ipc {
class PBackgroundChild;
} // namespace ipc
} // namespace mozilla
#define NS_IIPCBACKGROUNDCHILDCREATECALLBACK_IID \
{0x4de01707, 0x70e3, 0x4181, {0xbc, 0x9f, 0xa3, 0xec, 0xfe, 0x74, 0x1a, 0xe3}}
class NS_NO_VTABLE nsIIPCBackgroundChildCreateCallback : public nsISupports
{
public:
typedef mozilla::ipc::PBackgroundChild PBackgroundChild;
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IIPCBACKGROUNDCHILDCREATECALLBACK_IID)
// This will be called upon successful creation of a PBackgroundChild actor.
// The actor is unique per-thread and must not be shared across threads. It
// may be saved and reused on the same thread for as long as the thread lives.
// After this callback BackgroundChild::GetForCurrentThread() will return the
// same actor.
virtual void
ActorCreated(PBackgroundChild*) = 0;
// This will be called if for some reason the PBackgroundChild actor cannot be
// created. This should never be called in child processes as the failure to
// create the actor should result in the termination of the child process
// first. This may be called for cross-thread actors in the main process.
virtual void
ActorFailed() = 0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsIIPCBackgroundChildCreateCallback,
NS_IIPCBACKGROUNDCHILDCREATECALLBACK_IID)
#define NS_DECL_NSIIPCBACKGROUNDCHILDCREATECALLBACK \
virtual void \
ActorCreated(mozilla::ipc::PBackgroundChild*) override; \
virtual void \
ActorFailed() override;
#define NS_FORWARD_NSIIPCBACKGROUNDCHILDCREATECALLBACK(_to) \
virtual void \
ActorCreated(mozilla::ipc::PBackgroundChild* aActor) override \
{ _to ActorCreated(aActor); } \
virtual void \
ActorFailed() override \
{ _to ActorFailed(); }
#define NS_FORWARD_SAFE_NSIIPCBACKGROUNDCHILDCREATECALLBACK(_to) \
virtual void \
ActorCreated(mozilla::ipc::PBackgroundChild* aActor) override \
{ if (_to) { _to->ActorCreated(aActor); } } \
virtual void \
ActorFailed() override \
{ if (_to) { _to->ActorFailed(); } }
#endif // mozilla_ipc_nsiipcbackgroundchildcreatecallback_h

View File

@ -537,12 +537,6 @@ typedef bool
(* DeletePropertyOp)(JSContext* cx, JS::HandleObject obj, JS::HandleId id,
JS::ObjectOpResult& result);
typedef bool
(* WatchOp)(JSContext* cx, JS::HandleObject obj, JS::HandleId id, JS::HandleObject callable);
typedef bool
(* UnwatchOp)(JSContext* cx, JS::HandleObject obj, JS::HandleId id);
class JS_FRIEND_API(ElementAdder)
{
public:
@ -741,8 +735,6 @@ struct JS_STATIC_CLASS ObjectOps
SetPropertyOp setProperty;
GetOwnPropertyOp getOwnPropertyDescriptor;
DeletePropertyOp deleteProperty;
WatchOp watch;
UnwatchOp unwatch;
GetElementsOp getElements;
JSFunToStringOp funToString;
};
@ -896,8 +888,8 @@ struct JS_STATIC_CLASS Class
* Objects of this class aren't native objects. They don't have Shapes that
* describe their properties and layout. Classes using this flag must
* provide their own property behavior, either by being proxy classes (do
* this) or by overriding all the ObjectOps except getElements, watch and
* unwatch (don't do this).
* this) or by overriding all the ObjectOps except getElements
* (don't do this).
*/
static const uint32_t NON_NATIVE = JSCLASS_INTERNAL_FLAG2;
@ -974,8 +966,6 @@ struct JS_STATIC_CLASS Class
const { return oOps ? oOps->getOwnPropertyDescriptor
: nullptr; }
DeletePropertyOp getOpsDeleteProperty() const { return oOps ? oOps->deleteProperty : nullptr; }
WatchOp getOpsWatch() const { return oOps ? oOps->watch : nullptr; }
UnwatchOp getOpsUnwatch() const { return oOps ? oOps->unwatch : nullptr; }
GetElementsOp getOpsGetElements() const { return oOps ? oOps->getElements : nullptr; }
JSFunToStringOp getOpsFunToString() const { return oOps ? oOps->funToString : nullptr; }
};

View File

@ -344,12 +344,6 @@ class JS_FRIEND_API(BaseProxyHandler)
virtual bool isCallable(JSObject* obj) const;
virtual bool isConstructor(JSObject* obj) const;
// These two hooks must be overridden, or not overridden, in tandem -- no
// overriding just one!
virtual bool watch(JSContext* cx, JS::HandleObject proxy, JS::HandleId id,
JS::HandleObject callable) const;
virtual bool unwatch(JSContext* cx, JS::HandleObject proxy, JS::HandleId id) const;
virtual bool getElements(JSContext* cx, HandleObject proxy, uint32_t begin, uint32_t end,
ElementAdder* adder) const;

View File

@ -90,8 +90,6 @@ struct ProxyTraps {
bool (*isCallable)(JSObject *obj);
bool (*isConstructor)(JSObject *obj);
// watch
// unwatch
// getElements
// weakmapKeyDelegate

View File

@ -866,109 +866,6 @@ obj_assign(JSContext* cx, unsigned argc, Value* vp)
return true;
}
#if JS_HAS_OBJ_WATCHPOINT
bool
js::WatchHandler(JSContext* cx, JSObject* obj_, jsid id_, const JS::Value& old,
JS::Value* nvp, void* closure)
{
RootedObject obj(cx, obj_);
RootedId id(cx, id_);
/* Avoid recursion on (obj, id) already being watched on cx. */
AutoResolving resolving(cx, obj, id, AutoResolving::WATCH);
if (resolving.alreadyStarted())
return true;
FixedInvokeArgs<3> args(cx);
args[0].set(IdToValue(id));
args[1].set(old);
args[2].set(*nvp);
RootedValue callable(cx, ObjectValue(*static_cast<JSObject*>(closure)));
RootedValue thisv(cx, ObjectValue(*obj));
RootedValue rv(cx);
if (!Call(cx, callable, thisv, args, &rv))
return false;
*nvp = rv;
return true;
}
static bool
obj_watch(JSContext* cx, unsigned argc, Value* vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
RootedObject obj(cx, ToObject(cx, args.thisv()));
if (!obj)
return false;
if (!cx->compartment()->warnedAboutObjectWatch) {
if (!JS_ReportErrorFlagsAndNumberASCII(cx, JSREPORT_WARNING, GetErrorMessage, nullptr,
JSMSG_OBJECT_WATCH_DEPRECATED))
{
return false;
}
cx->compartment()->warnedAboutObjectWatch = true;
}
if (args.length() <= 1) {
ReportMissingArg(cx, args.calleev(), 1);
return false;
}
RootedObject callable(cx, ValueToCallable(cx, args[1], args.length() - 2));
if (!callable)
return false;
RootedId propid(cx);
if (!ValueToId<CanGC>(cx, args[0], &propid))
return false;
if (!WatchProperty(cx, obj, propid, callable))
return false;
args.rval().setUndefined();
return true;
}
static bool
obj_unwatch(JSContext* cx, unsigned argc, Value* vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
RootedObject obj(cx, ToObject(cx, args.thisv()));
if (!obj)
return false;
if (!cx->compartment()->warnedAboutObjectWatch) {
if (!JS_ReportErrorFlagsAndNumberASCII(cx, JSREPORT_WARNING, GetErrorMessage, nullptr,
JSMSG_OBJECT_WATCH_DEPRECATED))
{
return false;
}
cx->compartment()->warnedAboutObjectWatch = true;
}
RootedId id(cx);
if (args.length() != 0) {
if (!ValueToId<CanGC>(cx, args[0], &id))
return false;
} else {
id = JSID_VOID;
}
if (!UnwatchProperty(cx, obj, id))
return false;
args.rval().setUndefined();
return true;
}
#endif /* JS_HAS_OBJ_WATCHPOINT */
/* ES5 15.2.4.6. */
static bool
obj_isPrototypeOf(JSContext* cx, unsigned argc, Value* vp)
@ -1627,10 +1524,6 @@ static const JSFunctionSpec object_methods[] = {
JS_INLINABLE_FN(js_toString_str, obj_toString, 0,0, ObjectToString),
JS_SELF_HOSTED_FN(js_toLocaleString_str, "Object_toLocaleString", 0, 0),
JS_SELF_HOSTED_FN(js_valueOf_str, "Object_valueOf", 0,0),
#if JS_HAS_OBJ_WATCHPOINT
JS_FN(js_watch_str, obj_watch, 2,0),
JS_FN(js_unwatch_str, obj_unwatch, 1,0),
#endif
JS_SELF_HOSTED_FN(js_hasOwnProperty_str, "Object_hasOwnProperty", 1,0),
JS_FN(js_isPrototypeOf_str, obj_isPrototypeOf, 1,0),
JS_FN(js_propertyIsEnumerable_str, obj_propertyIsEnumerable, 1,0),

View File

@ -2221,7 +2221,6 @@ const ObjectOps TypedObject::objectOps_ = {
TypedObject::obj_setProperty,
TypedObject::obj_getOwnPropertyDescriptor,
TypedObject::obj_deleteProperty,
nullptr, nullptr, /* watch/unwatch */
nullptr, /* getElements */
nullptr, /* thisValue */
};

View File

@ -687,15 +687,13 @@ class MemoryCounter
}
void setMax(size_t newMax, const AutoLockGC& lock) {
// For compatibility treat any value that exceeds PTRDIFF_T_MAX to
// mean that value.
initialMaxBytes_ = (ptrdiff_t(newMax) >= 0) ? newMax : size_t(-1) >> 1;
initialMaxBytes_ = newMax;
maxBytes_ = initialMaxBytes_;
reset();
}
bool update(T* owner, size_t bytes) {
bytes_ += ptrdiff_t(bytes);
bytes_ += bytes;
if (MOZ_UNLIKELY(isTooMuchMalloc())) {
if (!triggered_)
triggered_ = owner->triggerGCForTooMuchMalloc();
@ -708,7 +706,7 @@ class MemoryCounter
other.reset();
}
ptrdiff_t bytes() const { return bytes_; }
size_t bytes() const { return bytes_; }
size_t maxBytes() const { return maxBytes_; }
size_t initialMaxBytes(const AutoLockGC& lock) const { return initialMaxBytes_; }
bool isTooMuchMalloc() const { return bytes_ >= maxBytes_; }

View File

@ -3358,9 +3358,8 @@ FOR_EACH_PUBLIC_TAGGED_GC_POINTER_TYPE(INSTANTIATE_ALL_VALID_HEAP_TRACE_FUNCTION
*
* There is an additional complication for certain kinds of edges that are not
* contained explicitly in the source object itself, such as from a weakmap key
* to its value, and from an object being watched by a watchpoint to the
* watchpoint's closure. These "implicit edges" are represented in some other
* container object, such as the weakmap or the watchpoint itself. In these
* to its value. These "implicit edges" are represented in some other
* container object, such as the weakmap itself. In these
* cases, calling unmark gray on an object won't find all of its children.
*
* Handling these implicit edges has two parts:

View File

@ -14,7 +14,6 @@
#include "jsgc.h"
#include "jsprf.h"
#include "jstypes.h"
#include "jswatchpoint.h"
#include "builtin/MapObject.h"
#include "frontend/BytecodeCompiler.h"

View File

@ -442,9 +442,6 @@ struct Zone : public JS::shadow::Zone,
return false;
}
void updateGCMallocBytesOnGC(const js::AutoLockGC& lock) {
gcMallocCounter.updateOnGC(lock);
}
void setGCMaxMallocBytes(size_t value, const js::AutoLockGC& lock) {
gcMallocCounter.setMax(value, lock);
}
@ -461,7 +458,7 @@ struct Zone : public JS::shadow::Zone,
// Updates all the memory counters after GC.
void updateAllMallocBytesOnGC(const js::AutoLockGC& lock) {
updateGCMallocBytesOnGC(lock);
gcMallocCounter.updateOnGC(lock);
jitCodeCounter.updateOnGC(lock);
}
bool isTooMuchMalloc() const {

View File

@ -1,8 +0,0 @@
// |jit-test| error:TypeError; need-for-each
// Binary: cache/js-dbg-32-29add08d84ae-linux
// Flags: -j
//
this.watch('y', /x/g );
for each (y in ['q', 'q', 'q']) continue;
gc();

View File

@ -1,6 +0,0 @@
// Binary: cache/js-dbg-64-38754465ffde-linux
// Flags:
//
this.__defineSetter__("x", gc);
this.watch("x",function(){return});
x = 3;

View File

@ -1,4 +0,0 @@
// Binary: cache/js-dbg-64-9d51f2a931f7-linux
// Flags:
//
({x:function(){}}).watch('x',function(){});

View File

@ -1,9 +0,0 @@
// Binary: cache/js-dbg-64-a6d7a5677b4c-linux
// Flags:
//
this.__defineSetter__("x", function(){})
this.watch("x", "".localeCompare)
window = x
Object.defineProperty(this, "x", ({
set: window
}))

View File

@ -4,7 +4,6 @@
var o9 = Function.prototype;
var o13 = Array;
function f5(o) {
o.watch('p3', function() {});
ox1 = new Proxy(o, {});
}
f5(o9);

View File

@ -1,9 +0,0 @@
// |jit-test| error:TypeError
// Binary: cache/js-dbg-32-1c8e91b2e3a4-linux
// Flags:
//
a = evalcx("lazy");
a.watch("x", function() {});
({}).watch("x", function() {});
a.__defineGetter__("y", {});

View File

@ -1,9 +0,0 @@
// Binary: cache/js-dbg-32-f951e9151626-linux
// Flags: -m -n
//
o = evalcx("lazy").__proto__
gc()
try {
o.watch()
} catch (e) {}
o.constructor()

View File

@ -1,10 +0,0 @@
// |jit-test| error:ReferenceError
// Binary: cache/js-dbg-64-67bf9a4a1f77-linux
// Flags: --ion-eager
//
(function () {
var a = ['x', 'y'];
obj.watch(a[+("0")], counter);
})();

View File

@ -1,6 +0,0 @@
// |jit-test| error:TypeError
// Binary: cache/js-dbg-64-bf8f2961d0cc-linux
// Flags:
//
Object.watch.call(new Uint8ClampedArray, "length", function() {});

View File

@ -1,8 +0,0 @@
gczeal(8, 1)
function recurse(x) {
recurse;
if (x < 20)
recurse(x + 1);
};
this.watch(5, (function () {}))
recurse(0)

View File

@ -1,13 +0,0 @@
// Don't crash or assert.
var d;
this.watch("d", eval);
(function () {
(eval("\
(function () {\
for (let x = 0; x < 2; ++x) {\
d = x\
}\
})\
"))()
})()

View File

@ -1,9 +0,0 @@
// |jit-test| error: TypeError
// don't assert
print(this.watch("x",
function() {
Object.defineProperty(this, "x", ({
get: (Int8Array)
}))
}))(x = /x/)

View File

@ -1,9 +0,0 @@
var n = 0;
var a = [];
for (var i = 0; i < 20; i++)
a[i] = {};
a[18].watch("p", function () { n++; });
delete a[18].p;
for (var i = 0; i < 20; i++)
a[i].p = 0;
assertEq(n, 1);

View File

@ -1,6 +0,0 @@
// |jit-test| error: TypeError
function f(o) {
o.watch("x", this);
}
var c = evalcx("");
f(c);

View File

@ -1,12 +0,0 @@
done = false;
try {
function x() {}
print(this.watch("d", Object.create))
var d = {}
} catch (e) {}
try {
eval("d = ''")
done = true;
} catch (e) {}
assertEq(done, false);

Some files were not shown because too many files have changed in this diff Show More