Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(29)

Side by Side Diff: Source/bindings/core/v8/WindowProxy.cpp

Issue 492453002: Make it clear a DocumentNameCollection can only contain HTMLElements (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Clean up Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/core/dom/Document.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 27 matching lines...) Expand all
38 #include "bindings/core/v8/V8Document.h" 38 #include "bindings/core/v8/V8Document.h"
39 #include "bindings/core/v8/V8GCForContextDispose.h" 39 #include "bindings/core/v8/V8GCForContextDispose.h"
40 #include "bindings/core/v8/V8HTMLCollection.h" 40 #include "bindings/core/v8/V8HTMLCollection.h"
41 #include "bindings/core/v8/V8HTMLDocument.h" 41 #include "bindings/core/v8/V8HTMLDocument.h"
42 #include "bindings/core/v8/V8HiddenValue.h" 42 #include "bindings/core/v8/V8HiddenValue.h"
43 #include "bindings/core/v8/V8Initializer.h" 43 #include "bindings/core/v8/V8Initializer.h"
44 #include "bindings/core/v8/V8ObjectConstructor.h" 44 #include "bindings/core/v8/V8ObjectConstructor.h"
45 #include "bindings/core/v8/V8Window.h" 45 #include "bindings/core/v8/V8Window.h"
46 #include "core/frame/LocalFrame.h" 46 #include "core/frame/LocalFrame.h"
47 #include "core/frame/csp/ContentSecurityPolicy.h" 47 #include "core/frame/csp/ContentSecurityPolicy.h"
48 #include "core/html/DocumentNameCollection.h"
48 #include "core/html/HTMLCollection.h" 49 #include "core/html/HTMLCollection.h"
49 #include "core/html/HTMLIFrameElement.h" 50 #include "core/html/HTMLIFrameElement.h"
50 #include "core/inspector/InspectorInstrumentation.h" 51 #include "core/inspector/InspectorInstrumentation.h"
51 #include "core/loader/DocumentLoader.h" 52 #include "core/loader/DocumentLoader.h"
52 #include "core/loader/FrameLoader.h" 53 #include "core/loader/FrameLoader.h"
53 #include "core/loader/FrameLoaderClient.h" 54 #include "core/loader/FrameLoaderClient.h"
54 #include "platform/RuntimeEnabledFeatures.h" 55 #include "platform/RuntimeEnabledFeatures.h"
55 #include "platform/ScriptForbiddenScope.h" 56 #include "platform/ScriptForbiddenScope.h"
56 #include "platform/TraceEvent.h" 57 #include "platform/TraceEvent.h"
57 #include "platform/heap/Handle.h" 58 #include "platform/heap/Handle.h"
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 updateActivityLogger(); 411 updateActivityLogger();
411 updateDocumentProperty(); 412 updateDocumentProperty();
412 updateSecurityOrigin(m_frame->document()->securityOrigin()); 413 updateSecurityOrigin(m_frame->document()->securityOrigin());
413 } 414 }
414 415
415 static v8::Handle<v8::Value> getNamedProperty(HTMLDocument* htmlDocument, const AtomicString& key, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) 416 static v8::Handle<v8::Value> getNamedProperty(HTMLDocument* htmlDocument, const AtomicString& key, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
416 { 417 {
417 if (!htmlDocument->hasNamedItem(key) && !htmlDocument->hasExtraNamedItem(key )) 418 if (!htmlDocument->hasNamedItem(key) && !htmlDocument->hasExtraNamedItem(key ))
418 return v8Undefined(); 419 return v8Undefined();
419 420
420 RefPtrWillBeRawPtr<HTMLCollection> items = htmlDocument->documentNamedItems( key); 421 RefPtrWillBeRawPtr<DocumentNameCollection> items = htmlDocument->documentNam edItems(key);
421 if (items->isEmpty()) 422 if (items->isEmpty())
422 return v8Undefined(); 423 return v8Undefined();
423 424
424 if (items->hasExactlyOneItem()) { 425 if (items->hasExactlyOneItem()) {
425 Element* element = items->item(0); 426 HTMLElement* element = items->item(0);
426 ASSERT(element); 427 ASSERT(element);
427 Frame* frame = isHTMLIFrameElement(*element) ? toHTMLIFrameElement(*elem ent).contentFrame() : 0; 428 Frame* frame = isHTMLIFrameElement(*element) ? toHTMLIFrameElement(*elem ent).contentFrame() : 0;
428 if (frame) 429 if (frame)
429 return toV8(frame->domWindow(), creationContext, isolate); 430 return toV8(frame->domWindow(), creationContext, isolate);
430 return toV8(element, creationContext, isolate); 431 return toV8(element, creationContext, isolate);
431 } 432 }
432 return toV8(items.release(), creationContext, isolate); 433 return toV8(items.release(), creationContext, isolate);
433 } 434 }
434 435
435 static void getter(v8::Local<v8::String> property, const v8::PropertyCallbackInf o<v8::Value>& info) 436 static void getter(v8::Local<v8::String> property, const v8::PropertyCallbackInf o<v8::Value>& info)
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 484
484 void WindowProxy::updateSecurityOrigin(SecurityOrigin* origin) 485 void WindowProxy::updateSecurityOrigin(SecurityOrigin* origin)
485 { 486 {
486 ASSERT(m_world->isMainWorld()); 487 ASSERT(m_world->isMainWorld());
487 if (!isContextInitialized()) 488 if (!isContextInitialized())
488 return; 489 return;
489 setSecurityToken(origin); 490 setSecurityToken(origin);
490 } 491 }
491 492
492 } // namespace blink 493 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | Source/core/dom/Document.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698