Merge inbound to mozilla-central. a=merge

This commit is contained in:
shindli 2019-03-23 11:47:34 +02:00
commit b3ac60ff06
16 changed files with 200 additions and 110 deletions

View File

@ -2,6 +2,10 @@
# Enable the artifact build.
ac_add_options --enable-artifact-builds
ac_add_options --enable-artifact-build-symbols
if test -n "$MOZ_ARTIFACT_TASK_WIN32_OPT" -a -z "$MOZ_DISABLE_FULL_SYMBOLS"; then
ac_add_options --enable-artifact-build-symbols=full
else
ac_add_options --enable-artifact-build-symbols
fi
. "$topsrcdir/build/mozconfig.no-compile"

View File

@ -544,6 +544,11 @@ ReplayDebugger.prototype = {
return data.map(source => this._addSource(source));
},
adoptSource(source) {
assert(source._dbg == this);
return source;
},
/////////////////////////////////////////////////////////
// Object methods
/////////////////////////////////////////////////////////

View File

@ -148,6 +148,19 @@ TabSources.prototype = {
},
getOrCreateSourceActor(source) {
// Tolerate the source coming from a different Debugger than the one
// associated with the thread.
try {
source = this._thread.dbg.adoptSource(source);
} catch (e) {
// We can't create actors for sources in the same compartment as the
// thread's Debugger.
if (/is in the same compartment as this debugger/.test(e)) {
return null;
}
throw e;
}
if (this.hasSourceActor(source)) {
return this.getSourceActor(source);
}

View File

@ -406,8 +406,7 @@ void HTMLFormElement::UnbindFromTree(bool aDeep, bool aNullParent) {
void HTMLFormElement::GetEventTargetParent(EventChainPreVisitor& aVisitor) {
aVisitor.mWantsWillHandleEvent = true;
if (aVisitor.mEvent->IsTrusted() &&
aVisitor.mEvent->mOriginalTarget == static_cast<nsIContent*>(this)) {
if (aVisitor.mEvent->mOriginalTarget == static_cast<nsIContent*>(this)) {
uint32_t msg = aVisitor.mEvent->mMessage;
if (msg == eFormSubmit) {
if (mGeneratingSubmit) {
@ -444,8 +443,7 @@ void HTMLFormElement::WillHandleEvent(EventChainPostVisitor& aVisitor) {
}
nsresult HTMLFormElement::PostHandleEvent(EventChainPostVisitor& aVisitor) {
if (aVisitor.mEvent->IsTrusted() &&
aVisitor.mEvent->mOriginalTarget == static_cast<nsIContent*>(this)) {
if (aVisitor.mEvent->mOriginalTarget == static_cast<nsIContent*>(this)) {
EventMessage msg = aVisitor.mEvent->mMessage;
if (msg == eFormSubmit) {
// let the form know not to defer subsequent submissions

View File

@ -21,6 +21,11 @@ class WeakCollectionObject : public NativeObject {
return static_cast<ObjectValueMap*>(getPrivate());
}
size_t sizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) {
ObjectValueMap* map = getMap();
return map ? map->sizeOfIncludingThis(aMallocSizeOf) : 0;
}
static MOZ_MUST_USE bool nondeterministicGetKeys(
JSContext* cx, Handle<WeakCollectionObject*> obj,
MutableHandleObject ret);

View File

@ -482,6 +482,10 @@ other kinds of objects.
other kind of object, and hence not a proper debuggee value, throw a
TypeError instead.
<code>adoptSource(<i>source</i>)</code>
: Given `source` of type `Debugger.Source` which is owned by an arbitrary
`Debugger`, return an equivalent `Debugger.Source` owned by this `Debugger`.
## Static methods of the Debugger Object
The functions described below are not called with a `this` value.

View File

@ -129,6 +129,10 @@ void WeakMapBase::restoreMarkedWeakMaps(WeakMapSet& markedWeakMaps) {
}
}
size_t ObjectValueMap::sizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) {
return mallocSizeOf(this) + shallowSizeOfExcludingThis(mallocSizeOf);
}
bool ObjectValueMap::findZoneEdges() {
/*
* For unmarked weakmap keys with delegates in a different zone, add a zone

View File

@ -262,6 +262,8 @@ class ObjectValueMap : public WeakMap<HeapPtr<JSObject*>, HeapPtr<Value>> {
ObjectValueMap(JSContext* cx, JSObject* obj) : WeakMap(cx, obj) {}
bool findZoneEdges() override;
size_t sizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf);
};
// Generic weak map for mapping objects to other objects.

View File

@ -5649,6 +5649,69 @@ bool Debugger::adoptDebuggeeValue(JSContext* cx, unsigned argc, Value* vp) {
return true;
}
class DebuggerAdoptSourceMatcher {
JSContext* cx_;
Debugger* dbg_;
public:
explicit DebuggerAdoptSourceMatcher(JSContext* cx, Debugger* dbg)
: cx_(cx), dbg_(dbg) {}
using ReturnType = JSObject*;
ReturnType match(HandleScriptSourceObject source) {
if (source->compartment() == cx_->compartment()) {
JS_ReportErrorASCII(cx_, "Source is in the same compartment as this debugger");
return nullptr;
}
return dbg_->wrapSource(cx_, source);
}
ReturnType match(Handle<WasmInstanceObject*> wasmInstance) {
if (wasmInstance->compartment() == cx_->compartment()) {
JS_ReportErrorASCII(cx_, "WasmInstance is in the same compartment as this debugger");
return nullptr;
}
return dbg_->wrapWasmSource(cx_, wasmInstance);
}
};
static inline NativeObject* GetSourceReferentRawObject(JSObject* obj);
static inline DebuggerSourceReferent GetSourceReferent(JSObject* obj);
bool Debugger::adoptSource(JSContext* cx, unsigned argc, Value* vp) {
THIS_DEBUGGER(cx, argc, vp, "adoptSource", args, dbg);
if (!args.requireAtLeast(cx, "Debugger.adoptSource", 1)) {
return false;
}
RootedObject obj(cx, NonNullObject(cx, args[0]));
if (!obj) {
return false;
}
obj = UncheckedUnwrap(obj);
if (obj->getClass() != &DebuggerSource_class) {
JS_ReportErrorASCII(cx, "Argument is not a Debugger.Source");
return false;
}
if (!GetSourceReferentRawObject(obj)) {
JS_ReportErrorASCII(cx, "Argument is Debugger.Source.prototype");
return false;
}
Rooted<DebuggerSourceReferent> referent(cx, GetSourceReferent(obj));
DebuggerAdoptSourceMatcher matcher(cx, dbg);
JSObject* res = referent.match(matcher);
if (!res) {
return false;
}
args.rval().setObject(*res);
return true;
}
const JSPropertySpec Debugger::properties[] = {
JS_PSGS("enabled", Debugger::getEnabled, Debugger::setEnabled, 0),
JS_PSGS("onDebuggerStatement", Debugger::getOnDebuggerStatement,
@ -5690,6 +5753,7 @@ const JSFunctionSpec Debugger::methods[] = {
JS_FN("makeGlobalObjectReference", Debugger::makeGlobalObjectReference, 1,
0),
JS_FN("adoptDebuggeeValue", Debugger::adoptDebuggeeValue, 1, 0),
JS_FN("adoptSource", Debugger::adoptSource, 1, 0),
JS_FS_END};
const JSFunctionSpec Debugger::static_methods[]{

View File

@ -787,6 +787,7 @@ class Debugger : private mozilla::LinkedListElement<Debugger> {
static bool drainTraceLogger(JSContext* cx, unsigned argc, Value* vp);
#endif
static bool adoptDebuggeeValue(JSContext* cx, unsigned argc, Value* vp);
static bool adoptSource(JSContext* cx, unsigned argc, Value* vp);
static bool construct(JSContext* cx, unsigned argc, Value* vp);
static const JSPropertySpec properties[];
static const JSFunctionSpec methods[];

View File

@ -31,6 +31,7 @@
#include "builtin/Object.h"
#include "builtin/String.h"
#include "builtin/Symbol.h"
#include "builtin/WeakSetObject.h"
#include "frontend/BytecodeCompiler.h"
#include "gc/Policy.h"
#include "jit/BaselineJIT.h"
@ -3958,6 +3959,9 @@ void JSObject::addSizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf,
ArrayBufferObject::addSizeOfExcludingThis(this, mallocSizeOf, info);
} else if (is<SharedArrayBufferObject>()) {
SharedArrayBufferObject::addSizeOfExcludingThis(this, mallocSizeOf, info);
} else if (is<WeakCollectionObject>()) {
info->objectsMallocHeapMisc +=
as<WeakCollectionObject>().sizeOfExcludingThis(mallocSizeOf);
#ifdef JS_HAS_CTYPES
} else {
// This must be the last case.

View File

@ -403,14 +403,7 @@ class MOZ_NON_PARAM Vector final : private AllocPolicy {
: CapacityAndReserved(aCapacity, aReserved) {}
CRAndStorage() = default;
T* storage() {
// If this returns |nullptr|, functions like |Vector::begin()| would too,
// breaking callers that pass a vector's elements as pointer/length to
// code that bounds its operation by length but (even just as a sanity
// check) always wants a non-null pointer. Fake up an aligned, non-null
// pointer to support these callers.
return reinterpret_cast<T*>(sizeof(T));
}
T* storage() { return nullptr; }
};
CRAndStorage<kInlineCapacity, 0> mTail;

View File

@ -506,67 +506,6 @@ static_assert(sizeof(Vector<Incomplete, 0>) ==
#endif // DEBUG
static void TestVectorBeginNonNull() {
// Vector::begin() should never return nullptr, to accommodate callers that
// (either for hygiene, or for semantic reasons) need a non-null pointer even
// for zero elements.
Vector<bool, 0> bvec0;
MOZ_RELEASE_ASSERT(bvec0.length() == 0);
MOZ_RELEASE_ASSERT(bvec0.begin() != nullptr);
Vector<bool, 1> bvec1;
MOZ_RELEASE_ASSERT(bvec1.length() == 0);
MOZ_RELEASE_ASSERT(bvec1.begin() != nullptr);
Vector<bool, 64> bvec64;
MOZ_RELEASE_ASSERT(bvec64.length() == 0);
MOZ_RELEASE_ASSERT(bvec64.begin() != nullptr);
Vector<int, 0> ivec0;
MOZ_RELEASE_ASSERT(ivec0.length() == 0);
MOZ_RELEASE_ASSERT(ivec0.begin() != nullptr);
Vector<int, 1> ivec1;
MOZ_RELEASE_ASSERT(ivec1.length() == 0);
MOZ_RELEASE_ASSERT(ivec1.begin() != nullptr);
Vector<int, 64> ivec64;
MOZ_RELEASE_ASSERT(ivec64.length() == 0);
MOZ_RELEASE_ASSERT(ivec64.begin() != nullptr);
Vector<long, 0> lvec0;
MOZ_RELEASE_ASSERT(lvec0.length() == 0);
MOZ_RELEASE_ASSERT(lvec0.begin() != nullptr);
Vector<long, 1> lvec1;
MOZ_RELEASE_ASSERT(lvec1.length() == 0);
MOZ_RELEASE_ASSERT(lvec1.begin() != nullptr);
Vector<long, 64> lvec64;
MOZ_RELEASE_ASSERT(lvec64.length() == 0);
MOZ_RELEASE_ASSERT(lvec64.begin() != nullptr);
// Vector<T, N> doesn't guarantee N inline elements -- the actual count is
// capped so that any Vector fits in a not-crazy amount of space -- so the
// code below won't overflow stacks or anything crazy.
struct VeryBig {
int array[16 * 1024 * 1024];
};
Vector<VeryBig, 0> vbvec0;
MOZ_RELEASE_ASSERT(vbvec0.length() == 0);
MOZ_RELEASE_ASSERT(vbvec0.begin() != nullptr);
Vector<VeryBig, 1> vbvec1;
MOZ_RELEASE_ASSERT(vbvec1.length() == 0);
MOZ_RELEASE_ASSERT(vbvec1.begin() != nullptr);
Vector<VeryBig, 64> vbvec64;
MOZ_RELEASE_ASSERT(vbvec64.length() == 0);
MOZ_RELEASE_ASSERT(vbvec64.begin() != nullptr);
}
int main() {
VectorTesting::testReserved();
VectorTesting::testConstRange();
@ -577,5 +516,4 @@ int main() {
VectorTesting::testReplaceRawBuffer();
VectorTesting::testInsert();
VectorTesting::testPodResizeToFit();
TestVectorBeginNonNull();
}

View File

@ -1,16 +1,20 @@
===
CDP
===
===============
Remote Protocol
===============
In addition to the Firefox Developer Tools _Remote Debugging Protocol_,
also known as RDP, Firefox also has a partial implementation of
the Chrome DevTools Protocol (CDP).
The Firefox **remote protocol** is a low-level debugging interface
you can use to inspect the state and control execution of documents
running in web content, instrument the browser in interesting ways,
simulate user interaction for automation purposes, and for subscribing
to updates in the browser such as network- or console logs.
It complements the existing Firefox Developer Tools `Remote Debugging
Protocol`_ (RDP) by implementing a subset of the `Chrome DevTools
Protocol`_ (CDP).
.. _Remote Debugging Protocol: https://docs.firefox-dev.tools/backend/protocol.html
.. _Chrome DevTools Protocol: https://chromedevtools.github.io/devtools-protocol/
The Firefox remote agent is a low-level debugging interface based on
the CDP protocol. With it, you can inspect the state and control
execution of documents running in web content, instrument Gecko in
interesting ways, simulate user interaction for automation purposes,
and debug JavaScript execution.
Users
=====
@ -21,6 +25,7 @@ Users
Usage.md
Prefs.md
Developers
==========
@ -48,10 +53,10 @@ Communication
The mailing list for Firefox remote debugging discussion is
`dev-remote@lists.mozilla.org`_ (`subscribe`_, `archive`_).
If you prefer real-time chat, there is often someone in the
#devtools IRC channel on irc.mozilla.org. Dont ask if you may
ask a question just go ahead and ask, and please wait for an answer
as we might not be in your timezone.
If you prefer real-time chat, there is often someone in the *#remote*
IRC channel on irc.mozilla.org. Dont ask if you may ask a
question just go ahead and ask, and please wait for an answer as
we might not be in your timezone.
.. _dev-remote@lists.mozilla.org: mailto:dev-remote@lists.mozilla.org
.. _subscribe: https://lists.mozilla.org/listinfo/dev-remote

View File

@ -1191,6 +1191,9 @@ win64-aarch64-shippable/opt:
env:
TOOLTOOL_MANIFEST: "browser/config/tooltool-manifests/win64/aarch64.manifest"
PERFHERDER_EXTRA_OPTIONS: aarch64
MOZ_ARTIFACT_TASK: {task-reference: '<win64-aarch64-opt>'}
MOZ_ARTIFACT_TASK_WIN32_OPT: {task-reference: '<win32-opt>'}
USE_ARTIFACT: '1'
run:
actions: [get-secrets, build]
options: [append-env-variables-from-configs]
@ -1204,7 +1207,57 @@ win64-aarch64-shippable/opt:
extra-config:
stage_platform: win64-aarch64
mozconfig_platform: win64-aarch64
dependencies:
win32-opt: build-win32-nightly/opt
win64-aarch64-opt: build-win64-aarch64-nightly-no-eme/opt
fetches:
# Abuse fetches to copy the generated-files artifact from the non-eme
# build directly to the artifacts directory of this build. Likewise
# for target.langpack.xpi
win64-aarch64-opt:
- artifact: target.generated-files.tar.gz
extract: false
dest: ../public/build
- artifact: target.langpack.xpi
extract: false
dest: ../public/build
run-on-projects: [] # Don't run by default yet
toolchains:
- win64-node
win64-aarch64-nightly-no-eme/opt:
description: "AArch64 Win64 Nightly w/o EME"
index:
product: firefox
job-name: win64-aarch64-no-eme-opt
type: nightly
attributes:
enable-full-crashsymbols: true
shipping-phase: build
shipping-product: firefox
treeherder:
platform: windows2012-aarch64/opt
symbol: Nn
tier: 1
worker-type: aws-provisioner-v1/gecko-{level}-b-win2012
worker:
max-run-time: 7200
env:
TOOLTOOL_MANIFEST: "browser/config/tooltool-manifests/win64/aarch64.manifest"
PERFHERDER_EXTRA_OPTIONS: aarch64-no-eme
run:
actions: [get-secrets, build]
options: [append-env-variables-from-configs]
script: mozharness/scripts/fx_desktop_build.py
secrets: true
config:
- builds/releng_base_firefox.py
- builds/taskcluster_base_windows.py
- taskcluster_nightly.py
extra-config:
stage_platform: win64-aarch64
mozconfig_platform: win64-aarch64
run-on-projects: []
toolchains:
- win64-clang-cl
- win64-aarch64-rust
@ -1233,6 +1286,9 @@ win64-aarch64-nightly/opt:
env:
TOOLTOOL_MANIFEST: "browser/config/tooltool-manifests/win64/aarch64.manifest"
PERFHERDER_EXTRA_OPTIONS: aarch64
MOZ_ARTIFACT_TASK: {task-reference: '<win64-aarch64-opt>'}
MOZ_ARTIFACT_TASK_WIN32_OPT: {task-reference: '<win32-opt>'}
USE_ARTIFACT: '1'
run:
actions: [get-secrets, build]
options: [append-env-variables-from-configs]
@ -1245,11 +1301,21 @@ win64-aarch64-nightly/opt:
extra-config:
stage_platform: win64-aarch64
mozconfig_platform: win64-aarch64
dependencies:
win32-opt: build-win32-nightly/opt
win64-aarch64-opt: build-win64-aarch64-nightly-no-eme/opt
fetches:
# Abuse fetches to copy the generated-files artifact from the non-eme
# build directly to the artifacts directory of this build. Likewise
# for target.langpack.xpi
win64-aarch64-opt:
- artifact: target.generated-files.tar.gz
extract: false
dest: ../public/build
- artifact: target.langpack.xpi
extract: false
dest: ../public/build
toolchains:
- win64-clang-cl
- win64-aarch64-rust
- win64-cbindgen
- win64-nasm
- win64-node

View File

@ -207,20 +207,4 @@ async_test(t => {
}, "clicking the child of a button by dispatching a non-bubbling event should not trigger submit");
async_test(t => {
const form = document.createElement("form");
const button = document.createElement("button");
button.type = "button";
button.onclick =
function(e) {
form.dispatchEvent(new Event("submit"), { bubbles: true});
};
form.appendChild(button);
document.body.appendChild(form);
button.click();
t.step_timeout(() => t.done(), 500);
}, "dispatching submit event should not trigger a submit");
</script>