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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 #include <v8-debug.h> | 69 #include <v8-debug.h> |
70 #include <v8.h> | 70 #include <v8.h> |
71 | 71 |
72 namespace blink { | 72 namespace blink { |
73 | 73 |
74 static void checkDocumentWrapper(v8::Local<v8::Object> wrapper, Document* docume
nt) | 74 static void checkDocumentWrapper(v8::Local<v8::Object> wrapper, Document* docume
nt) |
75 { | 75 { |
76 ASSERT(V8Document::toImpl(wrapper) == document); | 76 ASSERT(V8Document::toImpl(wrapper) == document); |
77 } | 77 } |
78 | 78 |
79 PassOwnPtrWillBeRawPtr<WindowProxy> WindowProxy::create(v8::Isolate* isolate, Fr
ame* frame, DOMWrapperWorld& world) | 79 RawPtr<WindowProxy> WindowProxy::create(v8::Isolate* isolate, Frame* frame, DOMW
rapperWorld& world) |
80 { | 80 { |
81 return adoptPtrWillBeNoop(new WindowProxy(frame, &world, isolate)); | 81 return new WindowProxy(frame, &world, isolate); |
82 } | 82 } |
83 | 83 |
84 WindowProxy::WindowProxy(Frame* frame, PassRefPtr<DOMWrapperWorld> world, v8::Is
olate* isolate) | 84 WindowProxy::WindowProxy(Frame* frame, PassRefPtr<DOMWrapperWorld> world, v8::Is
olate* isolate) |
85 : m_frame(frame) | 85 : m_frame(frame) |
86 , m_isolate(isolate) | 86 , m_isolate(isolate) |
87 , m_world(world) | 87 , m_world(world) |
88 { | 88 { |
89 } | 89 } |
90 | 90 |
91 WindowProxy::~WindowProxy() | 91 WindowProxy::~WindowProxy() |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 updateActivityLogger(); | 500 updateActivityLogger(); |
501 updateDocumentProperty(); | 501 updateDocumentProperty(); |
502 updateSecurityOrigin(m_frame->securityContext()->getSecurityOrigin()); | 502 updateSecurityOrigin(m_frame->securityContext()->getSecurityOrigin()); |
503 } | 503 } |
504 | 504 |
505 static v8::Local<v8::Value> getNamedProperty(HTMLDocument* htmlDocument, const A
tomicString& key, v8::Local<v8::Object> creationContext, v8::Isolate* isolate) | 505 static v8::Local<v8::Value> getNamedProperty(HTMLDocument* htmlDocument, const A
tomicString& key, v8::Local<v8::Object> creationContext, v8::Isolate* isolate) |
506 { | 506 { |
507 if (!htmlDocument->hasNamedItem(key) && !htmlDocument->hasExtraNamedItem(key
)) | 507 if (!htmlDocument->hasNamedItem(key) && !htmlDocument->hasExtraNamedItem(key
)) |
508 return v8Undefined(); | 508 return v8Undefined(); |
509 | 509 |
510 RefPtrWillBeRawPtr<DocumentNameCollection> items = htmlDocument->documentNam
edItems(key); | 510 RawPtr<DocumentNameCollection> items = htmlDocument->documentNamedItems(key)
; |
511 if (items->isEmpty()) | 511 if (items->isEmpty()) |
512 return v8Undefined(); | 512 return v8Undefined(); |
513 | 513 |
514 if (items->hasExactlyOneItem()) { | 514 if (items->hasExactlyOneItem()) { |
515 HTMLElement* element = items->item(0); | 515 HTMLElement* element = items->item(0); |
516 ASSERT(element); | 516 ASSERT(element); |
517 Frame* frame = isHTMLIFrameElement(*element) ? toHTMLIFrameElement(*elem
ent).contentFrame() : 0; | 517 Frame* frame = isHTMLIFrameElement(*element) ? toHTMLIFrameElement(*elem
ent).contentFrame() : 0; |
518 if (frame) | 518 if (frame) |
519 return toV8(frame->domWindow(), creationContext, isolate); | 519 return toV8(frame->domWindow(), creationContext, isolate); |
520 return toV8(element, creationContext, isolate); | 520 return toV8(element, creationContext, isolate); |
521 } | 521 } |
522 return toV8(PassRefPtrWillBeRawPtr<HTMLCollection>(items.release()), creatio
nContext, isolate); | 522 return toV8(RawPtr<HTMLCollection>(items.release()), creationContext, isolat
e); |
523 } | 523 } |
524 | 524 |
525 static void getter(v8::Local<v8::Name> property, const v8::PropertyCallbackInfo<
v8::Value>& info) | 525 static void getter(v8::Local<v8::Name> property, const v8::PropertyCallbackInfo<
v8::Value>& info) |
526 { | 526 { |
527 // FIXME: Consider passing StringImpl directly. | 527 // FIXME: Consider passing StringImpl directly. |
528 AtomicString name = toCoreAtomicString(property.As<v8::String>()); | 528 AtomicString name = toCoreAtomicString(property.As<v8::String>()); |
529 HTMLDocument* htmlDocument = V8HTMLDocument::toImpl(info.Holder()); | 529 HTMLDocument* htmlDocument = V8HTMLDocument::toImpl(info.Holder()); |
530 ASSERT(htmlDocument); | 530 ASSERT(htmlDocument); |
531 v8::Local<v8::Value> result = getNamedProperty(htmlDocument, name, info.Hold
er(), info.GetIsolate()); | 531 v8::Local<v8::Value> result = getNamedProperty(htmlDocument, name, info.Hold
er(), info.GetIsolate()); |
532 if (!result.IsEmpty()) { | 532 if (!result.IsEmpty()) { |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
574 } | 574 } |
575 | 575 |
576 void WindowProxy::updateSecurityOrigin(SecurityOrigin* origin) | 576 void WindowProxy::updateSecurityOrigin(SecurityOrigin* origin) |
577 { | 577 { |
578 if (!isContextInitialized()) | 578 if (!isContextInitialized()) |
579 return; | 579 return; |
580 setSecurityToken(origin); | 580 setSecurityToken(origin); |
581 } | 581 } |
582 | 582 |
583 } // namespace blink | 583 } // namespace blink |
OLD | NEW |