mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:17:44 +00:00
LibWeb: Introduce the Environment Settings Object
The environment settings object is effectively the context a piece of script is running under, for example, it contains the origin, responsible document, realm, global object and event loop for the current context. This effectively replaces ScriptExecutionContext, but it cannot be removed in this commit as EventTarget still depends on it. https://html.spec.whatwg.org/multipage/webappapis.html#environment-settings-object
This commit is contained in:
parent
4db5406d62
commit
f71f404e0c
29 changed files with 883 additions and 86 deletions
|
@ -9,6 +9,7 @@
|
|||
|
||||
#include <LibJS/AST.h>
|
||||
#include <LibJS/Bytecode/Generator.h>
|
||||
#include <LibJS/Runtime/ExecutionContext.h>
|
||||
#include <LibJS/Runtime/FunctionObject.h>
|
||||
|
||||
namespace JS {
|
||||
|
@ -86,6 +87,10 @@ public:
|
|||
|
||||
FunctionKind kind() const { return m_kind; }
|
||||
|
||||
// This is used by LibWeb to disassociate event handler attribute callback functions from the nearest script on the call stack.
|
||||
// https://html.spec.whatwg.org/multipage/webappapis.html#getting-the-current-value-of-the-event-handler Step 3.11
|
||||
void set_script_or_module(ScriptOrModule script_or_module) { m_script_or_module = move(script_or_module); }
|
||||
|
||||
protected:
|
||||
virtual bool is_strict_mode() const final { return m_strict; }
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include <AK/FlyString.h>
|
||||
#include <AK/WeakPtr.h>
|
||||
#include <LibJS/Forward.h>
|
||||
#include <LibJS/Module.h>
|
||||
#include <LibJS/Runtime/MarkedValueList.h>
|
||||
#include <LibJS/Runtime/PrivateEnvironment.h>
|
||||
#include <LibJS/Runtime/Value.h>
|
||||
|
@ -62,6 +63,10 @@ public:
|
|||
Value this_value;
|
||||
MarkedValueList arguments;
|
||||
bool is_strict_mode { false };
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/webappapis.html#skip-when-determining-incumbent-counter
|
||||
// FIXME: Move this out of LibJS (e.g. by using the CustomData concept), as it's used exclusively by LibWeb.
|
||||
size_t skip_when_determining_incumbent_counter { 0 };
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -45,6 +45,8 @@ public:
|
|||
Value reject(Value reason);
|
||||
Value perform_then(Value on_fulfilled, Value on_rejected, Optional<PromiseCapability> result_capability);
|
||||
|
||||
bool is_handled() const { return m_is_handled; }
|
||||
|
||||
protected:
|
||||
virtual void visit_edges(Visitor&) override;
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#include <AK/String.h>
|
||||
#include <LibJS/Runtime/Environment.h>
|
||||
#include <LibJS/Runtime/EnvironmentCoordinate.h>
|
||||
#include <LibJS/Runtime/ExecutionContext.h>
|
||||
#include <LibJS/Runtime/PropertyKey.h>
|
||||
#include <LibJS/Runtime/Value.h>
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue