| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2009 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 #include "bindings/core/v8/V8AbstractEventListener.h" | 34 #include "bindings/core/v8/V8AbstractEventListener.h" |
| 35 #include "bindings/core/v8/V8ArrayBufferView.h" | 35 #include "bindings/core/v8/V8ArrayBufferView.h" |
| 36 #include "bindings/core/v8/V8BindingMacros.h" | 36 #include "bindings/core/v8/V8BindingMacros.h" |
| 37 #include "bindings/core/v8/V8Element.h" | 37 #include "bindings/core/v8/V8Element.h" |
| 38 #include "bindings/core/v8/V8EventTarget.h" | 38 #include "bindings/core/v8/V8EventTarget.h" |
| 39 #include "bindings/core/v8/V8NodeFilter.h" | 39 #include "bindings/core/v8/V8NodeFilter.h" |
| 40 #include "bindings/core/v8/V8NodeFilterCondition.h" | 40 #include "bindings/core/v8/V8NodeFilterCondition.h" |
| 41 #include "bindings/core/v8/V8ObjectConstructor.h" | 41 #include "bindings/core/v8/V8ObjectConstructor.h" |
| 42 #include "bindings/core/v8/V8Window.h" | 42 #include "bindings/core/v8/V8Window.h" |
| 43 #include "bindings/core/v8/V8WorkerGlobalScope.h" | 43 #include "bindings/core/v8/V8WorkerGlobalScope.h" |
| 44 #include "bindings/core/v8/V8WorkletGlobalScope.h" |
| 44 #include "bindings/core/v8/V8XPathNSResolver.h" | 45 #include "bindings/core/v8/V8XPathNSResolver.h" |
| 45 #include "bindings/core/v8/WindowProxy.h" | 46 #include "bindings/core/v8/WindowProxy.h" |
| 46 #include "bindings/core/v8/WorkerOrWorkletScriptController.h" | 47 #include "bindings/core/v8/WorkerOrWorkletScriptController.h" |
| 47 #include "bindings/core/v8/custom/V8CustomXPathNSResolver.h" | 48 #include "bindings/core/v8/custom/V8CustomXPathNSResolver.h" |
| 48 #include "core/dom/Document.h" | 49 #include "core/dom/Document.h" |
| 49 #include "core/dom/Element.h" | 50 #include "core/dom/Element.h" |
| 50 #include "core/dom/FlexibleArrayBufferView.h" | 51 #include "core/dom/FlexibleArrayBufferView.h" |
| 51 #include "core/dom/NodeFilter.h" | 52 #include "core/dom/NodeFilter.h" |
| 52 #include "core/dom/QualifiedName.h" | 53 #include "core/dom/QualifiedName.h" |
| 53 #include "core/frame/LocalDOMWindow.h" | 54 #include "core/frame/LocalDOMWindow.h" |
| 54 #include "core/frame/LocalFrame.h" | 55 #include "core/frame/LocalFrame.h" |
| 55 #include "core/frame/Settings.h" | 56 #include "core/frame/Settings.h" |
| 56 #include "core/inspector/InspectorTraceEvents.h" | 57 #include "core/inspector/InspectorTraceEvents.h" |
| 57 #include "core/loader/FrameLoader.h" | 58 #include "core/loader/FrameLoader.h" |
| 58 #include "core/loader/FrameLoaderClient.h" | 59 #include "core/loader/FrameLoaderClient.h" |
| 59 #include "core/workers/WorkerGlobalScope.h" | 60 #include "core/workers/WorkerGlobalScope.h" |
| 61 #include "core/workers/WorkletGlobalScope.h" |
| 60 #include "core/xml/XPathNSResolver.h" | 62 #include "core/xml/XPathNSResolver.h" |
| 61 #include "platform/TracedValue.h" | 63 #include "platform/TracedValue.h" |
| 62 #include "wtf/MathExtras.h" | 64 #include "wtf/MathExtras.h" |
| 63 #include "wtf/StdLibExtras.h" | 65 #include "wtf/StdLibExtras.h" |
| 64 #include "wtf/Threading.h" | 66 #include "wtf/Threading.h" |
| 65 #include "wtf/text/AtomicString.h" | 67 #include "wtf/text/AtomicString.h" |
| 66 #include "wtf/text/CString.h" | 68 #include "wtf/text/CString.h" |
| 67 #include "wtf/text/CharacterNames.h" | 69 #include "wtf/text/CharacterNames.h" |
| 68 #include "wtf/text/StringBuffer.h" | 70 #include "wtf/text/StringBuffer.h" |
| 69 #include "wtf/text/StringHash.h" | 71 #include "wtf/text/StringHash.h" |
| (...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 684 ASSERT(window); | 686 ASSERT(window); |
| 685 } | 687 } |
| 686 return window; | 688 return window; |
| 687 } | 689 } |
| 688 | 690 |
| 689 LocalDOMWindow* currentDOMWindow(v8::Isolate* isolate) | 691 LocalDOMWindow* currentDOMWindow(v8::Isolate* isolate) |
| 690 { | 692 { |
| 691 return toLocalDOMWindow(toDOMWindow(isolate->GetCurrentContext())); | 693 return toLocalDOMWindow(toDOMWindow(isolate->GetCurrentContext())); |
| 692 } | 694 } |
| 693 | 695 |
| 694 namespace { | |
| 695 ExecutionContext* (*s_toExecutionContextForModules)(v8::Local<v8::Context>) = nu
llptr; | |
| 696 } | |
| 697 | |
| 698 ExecutionContext* toExecutionContext(v8::Local<v8::Context> context) | 696 ExecutionContext* toExecutionContext(v8::Local<v8::Context> context) |
| 699 { | 697 { |
| 700 if (context.IsEmpty()) | 698 if (context.IsEmpty()) |
| 701 return 0; | 699 return 0; |
| 702 v8::Local<v8::Object> global = context->Global(); | 700 v8::Local<v8::Object> global = context->Global(); |
| 703 v8::Local<v8::Object> windowWrapper = V8Window::findInstanceInPrototypeChain
(global, context->GetIsolate()); | 701 v8::Local<v8::Object> windowWrapper = V8Window::findInstanceInPrototypeChain
(global, context->GetIsolate()); |
| 704 if (!windowWrapper.IsEmpty()) | 702 if (!windowWrapper.IsEmpty()) |
| 705 return V8Window::toImpl(windowWrapper)->getExecutionContext(); | 703 return V8Window::toImpl(windowWrapper)->getExecutionContext(); |
| 706 v8::Local<v8::Object> workerWrapper = V8WorkerGlobalScope::findInstanceInPro
totypeChain(global, context->GetIsolate()); | 704 v8::Local<v8::Object> workerWrapper = V8WorkerGlobalScope::findInstanceInPro
totypeChain(global, context->GetIsolate()); |
| 707 if (!workerWrapper.IsEmpty()) | 705 if (!workerWrapper.IsEmpty()) |
| 708 return V8WorkerGlobalScope::toImpl(workerWrapper)->getExecutionContext()
; | 706 return V8WorkerGlobalScope::toImpl(workerWrapper)->getExecutionContext()
; |
| 709 ASSERT(s_toExecutionContextForModules); | 707 v8::Local<v8::Object> workletWrapper = V8WorkletGlobalScope::findInstanceInP
rototypeChain(global, context->GetIsolate()); |
| 710 return (*s_toExecutionContextForModules)(context); | 708 if (!workletWrapper.IsEmpty()) |
| 711 } | 709 return V8WorkletGlobalScope::toImpl(workletWrapper); |
| 712 | 710 // FIXME: Is this line of code reachable? |
| 713 void registerToExecutionContextForModules(ExecutionContext* (*toExecutionContext
ForModules)(v8::Local<v8::Context>)) | 711 return nullptr; |
| 714 { | |
| 715 s_toExecutionContextForModules = toExecutionContextForModules; | |
| 716 } | 712 } |
| 717 | 713 |
| 718 ExecutionContext* currentExecutionContext(v8::Isolate* isolate) | 714 ExecutionContext* currentExecutionContext(v8::Isolate* isolate) |
| 719 { | 715 { |
| 720 return toExecutionContext(isolate->GetCurrentContext()); | 716 return toExecutionContext(isolate->GetCurrentContext()); |
| 721 } | 717 } |
| 722 | 718 |
| 723 ExecutionContext* enteredExecutionContext(v8::Isolate* isolate) | 719 ExecutionContext* enteredExecutionContext(v8::Isolate* isolate) |
| 724 { | 720 { |
| 725 ExecutionContext* context = toExecutionContext(isolate->GetEnteredContext())
; | 721 ExecutionContext* context = toExecutionContext(isolate->GetEnteredContext())
; |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 934 v8SetReturnValue(info, perContextData->constructorForType(WrapperTypeInfo::u
nwrap(data))); | 930 v8SetReturnValue(info, perContextData->constructorForType(WrapperTypeInfo::u
nwrap(data))); |
| 935 } | 931 } |
| 936 | 932 |
| 937 v8::Local<v8::Value> freezeV8Object(v8::Local<v8::Value> value, v8::Isolate* iso
late) | 933 v8::Local<v8::Value> freezeV8Object(v8::Local<v8::Value> value, v8::Isolate* iso
late) |
| 938 { | 934 { |
| 939 v8CallOrCrash(value.As<v8::Object>()->SetIntegrityLevel(isolate->GetCurrentC
ontext(), v8::IntegrityLevel::kFrozen)); | 935 v8CallOrCrash(value.As<v8::Object>()->SetIntegrityLevel(isolate->GetCurrentC
ontext(), v8::IntegrityLevel::kFrozen)); |
| 940 return value; | 936 return value; |
| 941 } | 937 } |
| 942 | 938 |
| 943 } // namespace blink | 939 } // namespace blink |
| OLD | NEW |