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