mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-09 01:08:39 +09:00
Merge remote-tracking branch 'origin/tracking' into custom
This commit is contained in:
commit
20b787a4df
37 changed files with 523 additions and 153 deletions
|
|
@ -824,6 +824,10 @@ nsIContent::GetEventTargetParent(EventChainPreVisitor& aVisitor)
|
|||
aVisitor.mCanHandle = true;
|
||||
aVisitor.mMayHaveListenerManager = HasListenerManager();
|
||||
|
||||
if (IsInShadowTree()) {
|
||||
aVisitor.mItemInShadowTree = true;
|
||||
}
|
||||
|
||||
// Don't propagate mouseover and mouseout events when mouse is moving
|
||||
// inside chrome access only content.
|
||||
bool isAnonForEvents = IsRootOfChromeAccessOnlySubtree();
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@
|
|||
#include "mozilla/dom/HTMLTemplateElement.h"
|
||||
#include "mozilla/dom/ipc/BlobChild.h"
|
||||
#include "mozilla/dom/ipc/BlobParent.h"
|
||||
#include "mozilla/dom/MessagePort.h"
|
||||
#include "mozilla/dom/Promise.h"
|
||||
#include "mozilla/dom/ScriptSettings.h"
|
||||
#include "mozilla/dom/TabParent.h"
|
||||
|
|
@ -9993,3 +9994,71 @@ nsContentUtils::GetClosestNonNativeAnonymousAncestor(Element* aElement)
|
|||
}
|
||||
return e;
|
||||
}
|
||||
|
||||
/* static */ nsresult
|
||||
nsContentUtils::CreateJSValueFromSequenceOfObject(JSContext* aCx,
|
||||
const Sequence<JSObject*>& aTransfer,
|
||||
JS::MutableHandle<JS::Value> aValue)
|
||||
{
|
||||
if (aTransfer.IsEmpty()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
JS::Rooted<JSObject*> array(aCx, JS_NewArrayObject(aCx, aTransfer.Length()));
|
||||
if (!array) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < aTransfer.Length(); ++i) {
|
||||
JS::Rooted<JSObject*> object(aCx, aTransfer[i]);
|
||||
if (!object) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (NS_WARN_IF(!JS_DefineElement(aCx, array, i, object,
|
||||
JSPROP_ENUMERATE))) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
}
|
||||
|
||||
aValue.setObject(*array);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* static */
|
||||
void nsContentUtils::StructuredClone(JSContext* aCx,
|
||||
nsIGlobalObject* aGlobal,
|
||||
JS::Handle<JS::Value> aValue,
|
||||
const StructuredSerializeOptions& aOptions,
|
||||
JS::MutableHandle<JS::Value> aRv,
|
||||
ErrorResult& aError) {
|
||||
JS::Rooted<JS::Value> transferArray(aCx, JS::UndefinedValue());
|
||||
aError = nsContentUtils::CreateJSValueFromSequenceOfObject(
|
||||
aCx, aOptions.mTransfer, &transferArray);
|
||||
if (NS_WARN_IF(aError.Failed())) {
|
||||
return;
|
||||
}
|
||||
|
||||
JS::CloneDataPolicy clonePolicy;
|
||||
// FIXME: Uncomment once bug 1609990 and bug 1611855 lands.
|
||||
//clonePolicy.allowIntraClusterClonableSharedObjects();
|
||||
//clonePolicy.allowSharedMemoryObjects();
|
||||
|
||||
StructuredCloneHolder holder(StructuredCloneHolder::CloningSupported,
|
||||
StructuredCloneHolder::TransferringSupported,
|
||||
JS::StructuredCloneScope::SameProcessDifferentThread);
|
||||
holder.Write(aCx, aValue, transferArray, clonePolicy, aError);
|
||||
if (NS_WARN_IF(aError.Failed())) {
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: Pass clonePolicy.
|
||||
//holder.Read(this, aCx, aRv, clonePolicy, aError);
|
||||
holder.Read(aGlobal, aCx, aRv, aError);
|
||||
if (NS_WARN_IF(aError.Failed())) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsTArray<RefPtr<MessagePort>> ports = holder.TakeTransferredPorts();
|
||||
Unused << ports;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -132,6 +132,7 @@ class nsIContentParent;
|
|||
class TabChild;
|
||||
class Selection;
|
||||
class TabParent;
|
||||
struct StructuredSerializeOptions;
|
||||
} // namespace dom
|
||||
|
||||
namespace ipc {
|
||||
|
|
@ -2812,6 +2813,23 @@ public:
|
|||
static bool
|
||||
IsCustomElementsEnabled() { return sIsCustomElementsEnabled; }
|
||||
|
||||
static nsresult
|
||||
CreateJSValueFromSequenceOfObject(JSContext* aCx,
|
||||
const mozilla::dom::Sequence<JSObject*>& aTransfer,
|
||||
JS::MutableHandle<JS::Value> aValue);
|
||||
|
||||
/**
|
||||
* This implements the structured cloning algorithm as described by
|
||||
* https://html.spec.whatwg.org/#structured-cloning.
|
||||
*/
|
||||
static void
|
||||
StructuredClone(JSContext* aCx,
|
||||
nsIGlobalObject* aGlobal,
|
||||
JS::Handle<JS::Value> aValue,
|
||||
const mozilla::dom::StructuredSerializeOptions& aOptions,
|
||||
JS::MutableHandle<JS::Value> aRv,
|
||||
mozilla::ErrorResult& aError);
|
||||
|
||||
private:
|
||||
static bool InitializeEventTable();
|
||||
|
||||
|
|
|
|||
|
|
@ -909,7 +909,8 @@ nsPIDOMWindow<T>::nsPIDOMWindow(nsPIDOMWindowOuter *aOuterWindow)
|
|||
mOuterWindow(aOuterWindow),
|
||||
// Make sure no actual window ends up with mWindowID == 0
|
||||
mWindowID(NextWindowID()), mHasNotifiedGlobalCreated(false),
|
||||
mMarkedCCGeneration(0), mServiceWorkersTestingEnabled(false)
|
||||
mMarkedCCGeneration(0), mServiceWorkersTestingEnabled(false),
|
||||
mEvent(nullptr)
|
||||
{}
|
||||
|
||||
template<class T>
|
||||
|
|
@ -5245,6 +5246,16 @@ nsGlobalWindow::SetOpener(JSContext* aCx, JS::Handle<JS::Value> aOpener,
|
|||
SetOpenerWindow(outer, false);
|
||||
}
|
||||
|
||||
void
|
||||
nsGlobalWindow::GetEvent(JSContext* aCx, JS::MutableHandle<JS::Value> aRetval)
|
||||
{
|
||||
if (mEvent) {
|
||||
Unused << nsContentUtils::WrapNative(aCx, mEvent, aRetval);
|
||||
} else {
|
||||
aRetval.setUndefined();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsGlobalWindow::GetStatusOuter(nsAString& aStatus)
|
||||
{
|
||||
|
|
@ -8886,30 +8897,33 @@ nsGlobalWindow::PostMessageMoz(JSContext* aCx, JS::Handle<JS::Value> aMessage,
|
|||
}
|
||||
|
||||
void
|
||||
nsGlobalWindow::PostMessageMoz(JSContext* aCx, JS::Handle<JS::Value> aMessage,
|
||||
nsGlobalWindow::PostMessageMoz(JSContext* aCx,
|
||||
JS::Handle<JS::Value> aMessage,
|
||||
const nsAString& aTargetOrigin,
|
||||
const Optional<Sequence<JS::Value>>& aTransfer,
|
||||
const Sequence<JSObject*>& aTransfer,
|
||||
nsIPrincipal& aSubjectPrincipal,
|
||||
ErrorResult& aError)
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
JS::Rooted<JS::Value> transferArray(aCx, JS::UndefinedValue());
|
||||
if (aTransfer.WasPassed()) {
|
||||
const Sequence<JS::Value >& values = aTransfer.Value();
|
||||
|
||||
// The input sequence only comes from the generated bindings code, which
|
||||
// ensures it is rooted.
|
||||
JS::HandleValueArray elements =
|
||||
JS::HandleValueArray::fromMarkedLocation(values.Length(), values.Elements());
|
||||
|
||||
transferArray = JS::ObjectOrNullValue(JS_NewArrayObject(aCx, elements));
|
||||
if (transferArray.isNull()) {
|
||||
aError.Throw(NS_ERROR_OUT_OF_MEMORY);
|
||||
return;
|
||||
}
|
||||
aRv = nsContentUtils::CreateJSValueFromSequenceOfObject(aCx, aTransfer,
|
||||
&transferArray);
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
return;
|
||||
}
|
||||
|
||||
PostMessageMoz(aCx, aMessage, aTargetOrigin, transferArray,
|
||||
aSubjectPrincipal, aError);
|
||||
aSubjectPrincipal, aRv);
|
||||
}
|
||||
|
||||
void
|
||||
nsGlobalWindow::PostMessageMoz(JSContext* aCx,
|
||||
JS::Handle<JS::Value> aMessage,
|
||||
const WindowPostMessageOptions& aOptions,
|
||||
nsIPrincipal& aSubjectPrincipal,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
PostMessageMoz(aCx, aMessage, aOptions.mTargetOrigin, aOptions.mTransfer,
|
||||
aSubjectPrincipal, aRv);
|
||||
}
|
||||
|
||||
class nsCloseEvent : public Runnable {
|
||||
|
|
@ -14641,6 +14655,17 @@ nsGlobalWindow::CreateImageBitmap(const ImageBitmapSource& aImage,
|
|||
}
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/#structured-cloning
|
||||
void
|
||||
nsGlobalWindow::StructuredClone(JSContext* aCx,
|
||||
JS::Handle<JS::Value> aValue,
|
||||
const StructuredSerializeOptions& aOptions,
|
||||
JS::MutableHandle<JS::Value> aRv,
|
||||
ErrorResult& aError)
|
||||
{
|
||||
nsContentUtils::StructuredClone(aCx, this, aValue, aOptions, aRv, aError);
|
||||
}
|
||||
|
||||
// Helper called by methods that move/resize the window,
|
||||
// to ensure the presContext (if any) is aware of resolution
|
||||
// change that may happen in multi-monitor configuration.
|
||||
|
|
|
|||
|
|
@ -135,6 +135,7 @@ class TabGroup;
|
|||
class Timeout;
|
||||
class U2F;
|
||||
class WakeLock;
|
||||
struct WindowPostMessageOptions;
|
||||
class Worklet;
|
||||
namespace cache {
|
||||
class CacheStorage;
|
||||
|
|
@ -845,6 +846,7 @@ public:
|
|||
already_AddRefed<nsPIDOMWindowOuter> GetOpener() override;
|
||||
void SetOpener(JSContext* aCx, JS::Handle<JS::Value> aOpener,
|
||||
mozilla::ErrorResult& aError);
|
||||
void GetEvent(JSContext* aCx, JS::MutableHandle<JS::Value> aRetval);
|
||||
already_AddRefed<nsPIDOMWindowOuter> GetParentOuter();
|
||||
already_AddRefed<nsPIDOMWindowOuter> GetParent(mozilla::ErrorResult& aError);
|
||||
already_AddRefed<nsPIDOMWindowOuter> GetParent() override;
|
||||
|
|
@ -933,7 +935,12 @@ public:
|
|||
void Print(mozilla::ErrorResult& aError);
|
||||
void PostMessageMoz(JSContext* aCx, JS::Handle<JS::Value> aMessage,
|
||||
const nsAString& aTargetOrigin,
|
||||
const mozilla::dom::Optional<mozilla::dom::Sequence<JS::Value > >& aTransfer,
|
||||
const mozilla::dom::Sequence<JSObject*>& aTransfer,
|
||||
nsIPrincipal& aSubjectPrincipal,
|
||||
mozilla::ErrorResult& aRv);
|
||||
void PostMessageMoz(JSContext* aCx,
|
||||
JS::Handle<JS::Value> aMessage,
|
||||
const mozilla::dom::WindowPostMessageOptions& aOptions,
|
||||
nsIPrincipal& aSubjectPrincipal,
|
||||
mozilla::ErrorResult& aError);
|
||||
int32_t SetTimeout(JSContext* aCx, mozilla::dom::Function& aFunction,
|
||||
|
|
@ -1177,6 +1184,10 @@ public:
|
|||
const mozilla::dom::Sequence<mozilla::dom::ChannelPixelLayout>& aLayout,
|
||||
mozilla::ErrorResult& aRv);
|
||||
|
||||
void StructuredClone(JSContext* aCx, JS::Handle<JS::Value> aValue,
|
||||
const mozilla::dom::StructuredSerializeOptions& aOptions,
|
||||
JS::MutableHandle<JS::Value> aRv,
|
||||
mozilla::ErrorResult& aError);
|
||||
|
||||
// ChromeWindow bits. Do NOT call these unless your window is in
|
||||
// fact an nsGlobalChromeWindow.
|
||||
|
|
|
|||
|
|
@ -194,6 +194,10 @@ protected:
|
|||
// we have what it takes to do so.
|
||||
void MaybeCreateDoc();
|
||||
|
||||
// The event dispatch code sets and unsets this while keeping
|
||||
// the event object alive.
|
||||
nsIDOMEvent* mEvent;
|
||||
|
||||
public:
|
||||
inline bool IsLoadingOrRunningTimeout() const;
|
||||
|
||||
|
|
@ -789,6 +793,17 @@ public:
|
|||
return mInnerObjectsFreed;
|
||||
}
|
||||
|
||||
// Sets the event for window.event. Does NOT take ownership, so
|
||||
// the caller is responsible for clearing the event before the
|
||||
// event gets deallocated. Pass nullptr to set window.event to
|
||||
// undefined. Returns the previous value.
|
||||
nsIDOMEvent* SetEvent(nsIDOMEvent* aEvent)
|
||||
{
|
||||
nsIDOMEvent* old = mEvent;
|
||||
mEvent = aEvent;
|
||||
return old;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether this window is a secure context.
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue