OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2008, 2009, 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2008, 2009, 2011 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 24 matching lines...) Expand all Loading... | |
35 #include "bindings/core/v8/V8Binding.h" | 35 #include "bindings/core/v8/V8Binding.h" |
36 #include "bindings/core/v8/V8DOMActivityLogger.h" | 36 #include "bindings/core/v8/V8DOMActivityLogger.h" |
37 #include "bindings/core/v8/V8Document.h" | 37 #include "bindings/core/v8/V8Document.h" |
38 #include "bindings/core/v8/V8GCForContextDispose.h" | 38 #include "bindings/core/v8/V8GCForContextDispose.h" |
39 #include "bindings/core/v8/V8HTMLCollection.h" | 39 #include "bindings/core/v8/V8HTMLCollection.h" |
40 #include "bindings/core/v8/V8HTMLDocument.h" | 40 #include "bindings/core/v8/V8HTMLDocument.h" |
41 #include "bindings/core/v8/V8HiddenValue.h" | 41 #include "bindings/core/v8/V8HiddenValue.h" |
42 #include "bindings/core/v8/V8Initializer.h" | 42 #include "bindings/core/v8/V8Initializer.h" |
43 #include "bindings/core/v8/V8ObjectConstructor.h" | 43 #include "bindings/core/v8/V8ObjectConstructor.h" |
44 #include "bindings/core/v8/V8PagePopupControllerBinding.h" | 44 #include "bindings/core/v8/V8PagePopupControllerBinding.h" |
45 #include "bindings/core/v8/V8PrivateProperty.h" | |
45 #include "bindings/core/v8/V8Window.h" | 46 #include "bindings/core/v8/V8Window.h" |
46 #include "core/frame/LocalFrame.h" | 47 #include "core/frame/LocalFrame.h" |
47 #include "core/frame/csp/ContentSecurityPolicy.h" | 48 #include "core/frame/csp/ContentSecurityPolicy.h" |
48 #include "core/html/DocumentNameCollection.h" | 49 #include "core/html/DocumentNameCollection.h" |
49 #include "core/html/HTMLCollection.h" | 50 #include "core/html/HTMLCollection.h" |
50 #include "core/html/HTMLIFrameElement.h" | 51 #include "core/html/HTMLIFrameElement.h" |
51 #include "core/inspector/InspectorInstrumentation.h" | 52 #include "core/inspector/InspectorInstrumentation.h" |
52 #include "core/inspector/MainThreadDebugger.h" | 53 #include "core/inspector/MainThreadDebugger.h" |
53 #include "core/loader/DocumentLoader.h" | 54 #include "core/loader/DocumentLoader.h" |
54 #include "core/loader/FrameLoader.h" | 55 #include "core/loader/FrameLoader.h" |
55 #include "core/loader/FrameLoaderClient.h" | 56 #include "core/loader/FrameLoaderClient.h" |
56 #include "core/origin_trials/OriginTrialContext.h" | 57 #include "core/origin_trials/OriginTrialContext.h" |
57 #include "platform/Histogram.h" | 58 #include "platform/Histogram.h" |
58 #include "platform/RuntimeEnabledFeatures.h" | 59 #include "platform/RuntimeEnabledFeatures.h" |
59 #include "platform/ScriptForbiddenScope.h" | 60 #include "platform/ScriptForbiddenScope.h" |
60 #include "platform/TraceEvent.h" | 61 #include "platform/TraceEvent.h" |
61 #include "platform/heap/Handle.h" | 62 #include "platform/heap/Handle.h" |
62 #include "platform/weborigin/SecurityOrigin.h" | 63 #include "platform/weborigin/SecurityOrigin.h" |
63 #include "public/platform/Platform.h" | 64 #include "public/platform/Platform.h" |
64 #include "wtf/Assertions.h" | 65 #include "wtf/Assertions.h" |
65 #include "wtf/StringExtras.h" | 66 #include "wtf/StringExtras.h" |
66 #include "wtf/text/CString.h" | 67 #include "wtf/text/CString.h" |
67 #include <algorithm> | 68 #include <algorithm> |
69 #include <map> | |
haraken
2016/09/20 05:53:25
Remove this.
Alfonso
2016/09/20 13:48:23
Done.
| |
68 #include <utility> | 70 #include <utility> |
69 #include <v8-debug.h> | 71 #include <v8-debug.h> |
70 #include <v8.h> | 72 #include <v8.h> |
71 | 73 |
72 namespace blink { | 74 namespace blink { |
73 | 75 |
74 static void checkDocumentWrapper(v8::Local<v8::Object> wrapper, Document* docume nt) | 76 static void checkDocumentWrapper(v8::Local<v8::Object> wrapper, Document* docume nt) |
75 { | 77 { |
76 ASSERT(V8Document::toImpl(wrapper) == document); | 78 ASSERT(V8Document::toImpl(wrapper) == document); |
77 } | 79 } |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
403 LocalFrame* frame = toLocalFrame(m_frame); | 405 LocalFrame* frame = toLocalFrame(m_frame); |
404 v8::Local<v8::Value> documentWrapper = toV8(frame->document(), context->Glob al(), context->GetIsolate()); | 406 v8::Local<v8::Value> documentWrapper = toV8(frame->document(), context->Glob al(), context->GetIsolate()); |
405 if (documentWrapper.IsEmpty()) | 407 if (documentWrapper.IsEmpty()) |
406 return; | 408 return; |
407 ASSERT(documentWrapper == m_document.newLocal(m_isolate) || m_document.isEmp ty()); | 409 ASSERT(documentWrapper == m_document.newLocal(m_isolate) || m_document.isEmp ty()); |
408 if (m_document.isEmpty()) | 410 if (m_document.isEmpty()) |
409 updateDocumentWrapper(v8::Local<v8::Object>::Cast(documentWrapper)); | 411 updateDocumentWrapper(v8::Local<v8::Object>::Cast(documentWrapper)); |
410 checkDocumentWrapper(m_document.newLocal(m_isolate), frame->document()); | 412 checkDocumentWrapper(m_document.newLocal(m_isolate), frame->document()); |
411 | 413 |
412 ASSERT(documentWrapper->IsObject()); | 414 ASSERT(documentWrapper->IsObject()); |
413 // TODO(jochen): Don't replace the accessor with a data value. We need a way to tell v8 that the accessor's return value won't change after this point. | 415 |
414 if (!v8CallBoolean(context->Global()->ForceSet(context, v8AtomicString(m_iso late, "document"), documentWrapper, static_cast<v8::PropertyAttribute>(v8::ReadO nly | v8::DontDelete)))) | 416 // Update cache. |
415 return; | 417 CHECK(V8PrivateProperty::getWindow_document(m_isolate).set(context, context- >Global(), documentWrapper)); |
jochen (gone - plz use gerrit)
2016/09/19 14:54:19
I suspect that you need to do this also right afte
Alfonso
2016/09/20 13:48:23
Done. The test pass as is.
| |
416 } | 418 } |
417 | 419 |
418 void WindowProxy::updateActivityLogger() | 420 void WindowProxy::updateActivityLogger() |
419 { | 421 { |
420 m_scriptState->perContextData()->setActivityLogger(V8DOMActivityLogger::acti vityLogger( | 422 m_scriptState->perContextData()->setActivityLogger(V8DOMActivityLogger::acti vityLogger( |
421 m_world->worldId(), m_frame->isLocalFrame() && toLocalFrame(m_frame)->do cument() ? toLocalFrame(m_frame)->document()->baseURI() : KURL())); | 423 m_world->worldId(), m_frame->isLocalFrame() && toLocalFrame(m_frame)->do cument() ? toLocalFrame(m_frame)->document()->baseURI() : KURL())); |
422 } | 424 } |
423 | 425 |
424 void WindowProxy::setSecurityToken(SecurityOrigin* origin) | 426 void WindowProxy::setSecurityToken(SecurityOrigin* origin) |
425 { | 427 { |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
553 } | 555 } |
554 | 556 |
555 void WindowProxy::updateSecurityOrigin(SecurityOrigin* origin) | 557 void WindowProxy::updateSecurityOrigin(SecurityOrigin* origin) |
556 { | 558 { |
557 if (!isContextInitialized()) | 559 if (!isContextInitialized()) |
558 return; | 560 return; |
559 setSecurityToken(origin); | 561 setSecurityToken(origin); |
560 } | 562 } |
561 | 563 |
562 } // namespace blink | 564 } // namespace blink |
OLD | NEW |