|
@@ -2,13 +2,13 @@
|
|
|
# User Olli Pettay <Olli.Pettay@helsinki.fi>
|
|
|
# Date 1558686423 -10800
|
|
|
# Node ID 574e6b299f2d8683fa071ddee27c32ebb61dbc80
|
|
|
-# Parent 4c1b7df00533fd0971c5d472ce51d05d07039c56
|
|
|
+# Parent cf6919e788e54e0cdd7105dec5b3a4a08fca9d82
|
|
|
Bug 1480236 - Implement queueMicrotask(), r=baku
|
|
|
|
|
|
diff --git a/dom/base/nsIGlobalObject.cpp b/dom/base/nsIGlobalObject.cpp
|
|
|
--- a/dom/base/nsIGlobalObject.cpp
|
|
|
+++ b/dom/base/nsIGlobalObject.cpp
|
|
|
-@@ -1,19 +1,28 @@
|
|
|
+@@ -1,22 +1,30 @@
|
|
|
/* -*- 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
|
|
@@ -26,9 +26,12 @@ diff --git a/dom/base/nsIGlobalObject.cpp b/dom/base/nsIGlobalObject.cpp
|
|
|
+using mozilla::CycleCollectedJSContext;
|
|
|
+using mozilla::ErrorResult;
|
|
|
+using mozilla::IgnoredErrorResult;
|
|
|
+ using mozilla::Maybe;
|
|
|
+using mozilla::MicroTaskRunnable;
|
|
|
+ using mozilla::dom::ClientInfo;
|
|
|
+ using mozilla::dom::ServiceWorkerDescriptor;
|
|
|
+using mozilla::dom::VoidFunction;
|
|
|
-+
|
|
|
+
|
|
|
nsIGlobalObject::~nsIGlobalObject()
|
|
|
{
|
|
|
UnlinkHostObjectURIs();
|
|
@@ -36,9 +39,7 @@ diff --git a/dom/base/nsIGlobalObject.cpp b/dom/base/nsIGlobalObject.cpp
|
|
|
|
|
|
nsIPrincipal*
|
|
|
nsIGlobalObject::PrincipalOrNull()
|
|
|
- {
|
|
|
-@@ -107,8 +116,34 @@ nsIGlobalObject::TraverseHostObjectURIs(
|
|
|
- if (!NS_IsMainThread()) {
|
|
|
+@@ -112,16 +120,42 @@ nsIGlobalObject::TraverseHostObjectURIs(
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -46,7 +47,7 @@ diff --git a/dom/base/nsIGlobalObject.cpp b/dom/base/nsIGlobalObject.cpp
|
|
|
nsHostObjectProtocolHandler::Traverse(mHostObjectURIs[index], aCb);
|
|
|
}
|
|
|
}
|
|
|
-+
|
|
|
+
|
|
|
+class QueuedMicrotask : public MicroTaskRunnable {
|
|
|
+ public:
|
|
|
+ QueuedMicrotask(nsIGlobalObject* aGlobal, VoidFunction& aCallback)
|
|
@@ -72,10 +73,19 @@ diff --git a/dom/base/nsIGlobalObject.cpp b/dom/base/nsIGlobalObject.cpp
|
|
|
+ context->DispatchToMicroTask(mt.forget());
|
|
|
+ }
|
|
|
+}
|
|
|
++
|
|
|
+ Maybe<ClientInfo>
|
|
|
+ nsIGlobalObject::GetClientInfo() const
|
|
|
+ {
|
|
|
+ // By default globals do not expose themselves as a client. Only real
|
|
|
+ // window and worker globals are currently considered clients.
|
|
|
+ return Maybe<ClientInfo>();
|
|
|
+ }
|
|
|
+
|
|
|
diff --git a/dom/base/nsIGlobalObject.h b/dom/base/nsIGlobalObject.h
|
|
|
--- a/dom/base/nsIGlobalObject.h
|
|
|
+++ b/dom/base/nsIGlobalObject.h
|
|
|
-@@ -15,16 +15,22 @@
|
|
|
+@@ -18,16 +18,22 @@
|
|
|
|
|
|
#define NS_IGLOBALOBJECT_IID \
|
|
|
{ 0x11afa8be, 0xd997, 0x4e07, \
|
|
@@ -98,14 +108,14 @@ diff --git a/dom/base/nsIGlobalObject.h b/dom/base/nsIGlobalObject.h
|
|
|
|
|
|
protected:
|
|
|
nsIGlobalObject()
|
|
|
-@@ -71,16 +77,18 @@ public:
|
|
|
+@@ -80,16 +86,18 @@ public:
|
|
|
+ virtual bool IsInSyncOperation() { return false; }
|
|
|
|
|
|
- // Any CC class inheriting nsIGlobalObject should call these 2 methods if it
|
|
|
- // exposes the URL API.
|
|
|
- void UnlinkHostObjectURIs();
|
|
|
- void TraverseHostObjectURIs(nsCycleCollectionTraversalCallback &aCb);
|
|
|
+ virtual mozilla::Maybe<mozilla::dom::ClientInfo>
|
|
|
+ GetClientInfo() const;
|
|
|
|
|
|
- virtual bool IsInSyncOperation() { return false; }
|
|
|
+ virtual mozilla::Maybe<mozilla::dom::ServiceWorkerDescriptor>
|
|
|
+ GetController() const;
|
|
|
|
|
|
+ void QueueMicrotask(mozilla::dom::VoidFunction& aCallback);
|
|
|
+
|