| Index: include/v8.h
|
| diff --git a/include/v8.h b/include/v8.h
|
| index d4b664a5495a2481f3db61274be6ef6948889371..50a03d3e3b2bf923078b493dea2cb3e83e79eb41 100644
|
| --- a/include/v8.h
|
| +++ b/include/v8.h
|
| @@ -973,6 +973,34 @@ class V8_EXPORT Data {
|
|
|
|
|
| /**
|
| + * The optional attributes of ScriptOrigin.
|
| + */
|
| +class ScriptOriginOptions {
|
| + public:
|
| + V8_INLINE ScriptOriginOptions(bool is_embedder_debug_script = false,
|
| + bool is_shared_cross_origin = false,
|
| + bool is_opaque = false)
|
| + : flags_((is_embedder_debug_script ? kIsEmbedderDebugScript : 0) |
|
| + (is_shared_cross_origin ? kIsSharedCrossOrigin : 0) |
|
| + (is_opaque ? kIsOpaque : 0)) {}
|
| + V8_INLINE ScriptOriginOptions(int flags)
|
| + : flags_(flags &
|
| + (kIsEmbedderDebugScript | kIsSharedCrossOrigin | kIsOpaque)) {}
|
| + bool IsEmbedderDebugScript() const { return flags_ & kIsEmbedderDebugScript; }
|
| + bool IsSharedCrossOrigin() const { return flags_ & kIsSharedCrossOrigin; }
|
| + bool IsOpaque() const { return flags_ & kIsOpaque; }
|
| + int Flags() const { return flags_; }
|
| +
|
| + private:
|
| + enum {
|
| + kIsEmbedderDebugScript = 1,
|
| + kIsSharedCrossOrigin = 1 << 1,
|
| + kIsOpaque = 1 << 2
|
| + };
|
| + const int flags_;
|
| +};
|
| +
|
| +/**
|
| * The origin, within a file, of a script.
|
| */
|
| class ScriptOrigin {
|
| @@ -984,31 +1012,23 @@ class ScriptOrigin {
|
| Handle<Boolean> resource_is_shared_cross_origin = Handle<Boolean>(),
|
| Handle<Integer> script_id = Handle<Integer>(),
|
| Handle<Boolean> resource_is_embedder_debug_script = Handle<Boolean>(),
|
| - Handle<Value> source_map_url = Handle<Value>())
|
| - : resource_name_(resource_name),
|
| - resource_line_offset_(resource_line_offset),
|
| - resource_column_offset_(resource_column_offset),
|
| - resource_is_embedder_debug_script_(resource_is_embedder_debug_script),
|
| - resource_is_shared_cross_origin_(resource_is_shared_cross_origin),
|
| - script_id_(script_id),
|
| - source_map_url_(source_map_url) {}
|
| + Handle<Value> source_map_url = Handle<Value>(),
|
| + Handle<Boolean> resource_is_opaque = Handle<Boolean>());
|
| V8_INLINE Handle<Value> ResourceName() const;
|
| V8_INLINE Handle<Integer> ResourceLineOffset() const;
|
| V8_INLINE Handle<Integer> ResourceColumnOffset() const;
|
| /**
|
| * Returns true for embedder's debugger scripts
|
| */
|
| - V8_INLINE Handle<Boolean> ResourceIsEmbedderDebugScript() const;
|
| - V8_INLINE Handle<Boolean> ResourceIsSharedCrossOrigin() const;
|
| V8_INLINE Handle<Integer> ScriptID() const;
|
| V8_INLINE Handle<Value> SourceMapUrl() const;
|
| + V8_INLINE ScriptOriginOptions Options() const { return options_; }
|
|
|
| private:
|
| Handle<Value> resource_name_;
|
| Handle<Integer> resource_line_offset_;
|
| Handle<Integer> resource_column_offset_;
|
| - Handle<Boolean> resource_is_embedder_debug_script_;
|
| - Handle<Boolean> resource_is_shared_cross_origin_;
|
| + ScriptOriginOptions options_;
|
| Handle<Integer> script_id_;
|
| Handle<Value> source_map_url_;
|
| };
|
| @@ -1160,8 +1180,7 @@ class V8_EXPORT ScriptCompiler {
|
| Handle<Value> resource_name;
|
| Handle<Integer> resource_line_offset;
|
| Handle<Integer> resource_column_offset;
|
| - Handle<Boolean> resource_is_embedder_debug_script;
|
| - Handle<Boolean> resource_is_shared_cross_origin;
|
| + ScriptOriginOptions resource_options;
|
| Handle<Value> source_map_url;
|
|
|
| // Cached data from previous compilation (if a kConsume*Cache flag is
|
| @@ -1450,6 +1469,7 @@ class V8_EXPORT Message {
|
| * this Message was generated to V8.
|
| */
|
| bool IsSharedCrossOrigin() const;
|
| + bool IsOpaque() const;
|
|
|
| // TODO(1245381): Print to a string instead of on a FILE.
|
| static void PrintCurrentStackTrace(Isolate* isolate, FILE* out);
|
| @@ -7226,6 +7246,24 @@ int FunctionCallbackInfo<T>::Length() const {
|
| return length_;
|
| }
|
|
|
| +ScriptOrigin::ScriptOrigin(Handle<Value> resource_name,
|
| + Handle<Integer> resource_line_offset,
|
| + Handle<Integer> resource_column_offset,
|
| + Handle<Boolean> resource_is_shared_cross_origin,
|
| + Handle<Integer> script_id,
|
| + Handle<Boolean> resource_is_embedder_debug_script,
|
| + Handle<Value> source_map_url,
|
| + Handle<Boolean> resource_is_opaque)
|
| + : resource_name_(resource_name),
|
| + resource_line_offset_(resource_line_offset),
|
| + resource_column_offset_(resource_column_offset),
|
| + options_(!resource_is_embedder_debug_script.IsEmpty() &&
|
| + resource_is_embedder_debug_script->IsTrue(),
|
| + !resource_is_shared_cross_origin.IsEmpty() &&
|
| + resource_is_shared_cross_origin->IsTrue(),
|
| + !resource_is_opaque.IsEmpty() && resource_is_opaque->IsTrue()),
|
| + script_id_(script_id),
|
| + source_map_url_(source_map_url) {}
|
|
|
| Handle<Value> ScriptOrigin::ResourceName() const {
|
| return resource_name_;
|
| @@ -7242,16 +7280,6 @@ Handle<Integer> ScriptOrigin::ResourceColumnOffset() const {
|
| }
|
|
|
|
|
| -Handle<Boolean> ScriptOrigin::ResourceIsEmbedderDebugScript() const {
|
| - return resource_is_embedder_debug_script_;
|
| -}
|
| -
|
| -
|
| -Handle<Boolean> ScriptOrigin::ResourceIsSharedCrossOrigin() const {
|
| - return resource_is_shared_cross_origin_;
|
| -}
|
| -
|
| -
|
| Handle<Integer> ScriptOrigin::ScriptID() const {
|
| return script_id_;
|
| }
|
| @@ -7266,8 +7294,7 @@ ScriptCompiler::Source::Source(Local<String> string, const ScriptOrigin& origin,
|
| resource_name(origin.ResourceName()),
|
| resource_line_offset(origin.ResourceLineOffset()),
|
| resource_column_offset(origin.ResourceColumnOffset()),
|
| - resource_is_embedder_debug_script(origin.ResourceIsEmbedderDebugScript()),
|
| - resource_is_shared_cross_origin(origin.ResourceIsSharedCrossOrigin()),
|
| + resource_options(origin.Options()),
|
| source_map_url(origin.SourceMapUrl()),
|
| cached_data(data) {}
|
|
|
|
|