Commit 4c5c2dbe authored by Yuki Yamada's avatar Yuki Yamada Committed by Commit Bot

Removed blink::V8WorkerOrWorkletEventListener

Removed blink::V8WorkerOrWorkletEventListener and replaced it by
blink::V8EventListener. The small differences between these were removed
in previous CLs.

Some codes for checking whether frame exists or not should have been
removed in previous CL(https://chromium-review.googlesource.com/1160069),
but it is done here.

Bug: 869778
Change-Id: Ia6ceb8bb5481384db75265aca07e901f737873a4
Reviewed-on: https://chromium-review.googlesource.com/1160128
Commit-Queue: Yuki Yamada <yukiy@google.com>
Reviewed-by: default avatarHitoshi Yoshida <peria@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Reviewed-by: default avatarYuki Shiino <yukishiino@chromium.org>
Cr-Commit-Position: refs/heads/master@{#581455}
parent 3468d5a5
...@@ -150,8 +150,6 @@ bindings_core_v8_files = ...@@ -150,8 +150,6 @@ bindings_core_v8_files =
"core/v8/v8_v0_custom_element_lifecycle_callbacks.h", "core/v8/v8_v0_custom_element_lifecycle_callbacks.h",
"core/v8/v8_wasm_response_extensions.cc", "core/v8/v8_wasm_response_extensions.cc",
"core/v8/v8_wasm_response_extensions.h", "core/v8/v8_wasm_response_extensions.h",
"core/v8/v8_worker_or_worklet_event_listener.cc",
"core/v8/v8_worker_or_worklet_event_listener.h",
"core/v8/window_proxy.cc", "core/v8/window_proxy.cc",
"core/v8/window_proxy.h", "core/v8/window_proxy.h",
"core/v8/window_proxy_manager.cc", "core/v8/window_proxy_manager.cc",
......
...@@ -97,12 +97,6 @@ v8::Local<v8::Value> V8EventListener::CallListenerFunction( ...@@ -97,12 +97,6 @@ v8::Local<v8::Value> V8EventListener::CallListenerFunction(
ExecutionContext* execution_context = ExecutionContext* execution_context =
ToExecutionContext(script_state->GetContext()); ToExecutionContext(script_state->GetContext());
if (!execution_context->IsDocument())
return v8::Local<v8::Value>();
LocalFrame* frame = ToDocument(execution_context)->GetFrame();
if (!frame)
return v8::Local<v8::Value>();
// TODO(jochen): Consider moving this check into canExecuteScripts. // TODO(jochen): Consider moving this check into canExecuteScripts.
// http://crbug.com/608641 // http://crbug.com/608641
...@@ -112,7 +106,7 @@ v8::Local<v8::Value> V8EventListener::CallListenerFunction( ...@@ -112,7 +106,7 @@ v8::Local<v8::Value> V8EventListener::CallListenerFunction(
v8::Local<v8::Value> parameters[1] = {js_event}; v8::Local<v8::Value> parameters[1] = {js_event};
v8::Local<v8::Value> result; v8::Local<v8::Value> result;
if (!V8ScriptRunner::CallFunction(handler_function, frame->GetDocument(), if (!V8ScriptRunner::CallFunction(handler_function, execution_context,
receiver, base::size(parameters), receiver, base::size(parameters),
parameters, script_state->GetIsolate()) parameters, script_state->GetIsolate())
.ToLocal(&result)) .ToLocal(&result))
......
...@@ -35,7 +35,6 @@ ...@@ -35,7 +35,6 @@
#include "third_party/blink/renderer/bindings/core/v8/v8_error_handler.h" #include "third_party/blink/renderer/bindings/core/v8/v8_error_handler.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_event_listener.h" #include "third_party/blink/renderer/bindings/core/v8/v8_event_listener.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_window.h" #include "third_party/blink/renderer/bindings/core/v8/v8_window.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_worker_or_worklet_event_listener.h"
#include "third_party/blink/renderer/platform/bindings/v8_private_property.h" #include "third_party/blink/renderer/platform/bindings/v8_private_property.h"
namespace blink { namespace blink {
...@@ -80,11 +79,8 @@ V8AbstractEventListener* V8EventListenerHelper::GetEventListener( ...@@ -80,11 +79,8 @@ V8AbstractEventListener* V8EventListenerHelper::GetEventListener(
return GetEventListenerInternal<V8AbstractEventListener>( return GetEventListenerInternal<V8AbstractEventListener>(
script_state, object, listener_property, lookup, script_state, object, listener_property, lookup,
[object, is_attribute, script_state, listener_property]() { [object, is_attribute, script_state, listener_property]() {
return script_state->World().IsWorkerWorld() return V8EventListener::Create(object, is_attribute, script_state,
? V8WorkerOrWorkletEventListener::Create( listener_property);
object, is_attribute, script_state, listener_property)
: V8EventListener::Create(object, is_attribute, script_state,
listener_property);
}); });
} }
......
/*
* Copyright (C) 2006, 2007, 2008, 2009 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "third_party/blink/renderer/bindings/core/v8/v8_worker_or_worklet_event_listener.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_event.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_event_target.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_gc_controller.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_script_runner.h"
#include "third_party/blink/renderer/bindings/core/v8/worker_or_worklet_script_controller.h"
#include "third_party/blink/renderer/core/execution_context/execution_context.h"
#include "third_party/blink/renderer/core/inspector/inspector_trace_events.h"
#include "third_party/blink/renderer/core/probe/core_probes.h"
#include "third_party/blink/renderer/core/workers/worker_or_worklet_global_scope.h"
#include "third_party/blink/renderer/platform/bindings/v8_dom_wrapper.h"
namespace blink {
V8WorkerOrWorkletEventListener::V8WorkerOrWorkletEventListener(
bool is_inline,
ScriptState* script_state)
: V8EventListener(is_inline, script_state) {}
v8::Local<v8::Value> V8WorkerOrWorkletEventListener::CallListenerFunction(
ScriptState* script_state,
v8::Local<v8::Value> js_event,
Event* event) {
DCHECK(!js_event.IsEmpty());
v8::Local<v8::Function> handler_function = GetListenerFunction(script_state);
v8::Local<v8::Object> receiver = GetReceiverObject(script_state, event);
if (handler_function.IsEmpty() || receiver.IsEmpty())
return v8::Local<v8::Value>();
v8::Local<v8::Value> parameters[1] = {js_event};
v8::MaybeLocal<v8::Value> maybe_result = V8ScriptRunner::CallFunction(
handler_function, ToExecutionContext(script_state->GetContext()),
receiver, base::size(parameters), parameters, GetIsolate());
v8::Local<v8::Value> result;
if (!maybe_result.ToLocal(&result))
return v8::Local<v8::Value>();
return result;
}
} // namespace blink
/*
* Copyright (C) 2006, 2007, 2008, 2009 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef THIRD_PARTY_BLINK_RENDERER_BINDINGS_CORE_V8_V8_WORKER_OR_WORKLET_EVENT_LISTENER_H_
#define THIRD_PARTY_BLINK_RENDERER_BINDINGS_CORE_V8_V8_WORKER_OR_WORKLET_EVENT_LISTENER_H_
#include "base/memory/scoped_refptr.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_event_listener.h"
#include "v8/include/v8.h"
namespace blink {
class Event;
class V8WorkerOrWorkletEventListener final : public V8EventListener {
public:
static V8WorkerOrWorkletEventListener* Create(
v8::Local<v8::Object> listener,
bool is_inline,
ScriptState* script_state,
const V8PrivateProperty::Symbol& property) {
V8WorkerOrWorkletEventListener* event_listener =
new V8WorkerOrWorkletEventListener(is_inline, script_state);
event_listener->SetListenerObject(script_state, listener, property);
return event_listener;
}
protected:
V8WorkerOrWorkletEventListener(bool is_inline, ScriptState*);
private:
v8::Local<v8::Value> CallListenerFunction(ScriptState*,
v8::Local<v8::Value>,
Event*) override;
};
} // namespace blink
#endif // THIRD_PARTY_BLINK_RENDERER_BINDINGS_CORE_V8_V8_WORKER_OR_WORKLET_EVENT_LISTENER_H_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment