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

Side by Side Diff: Source/core/frame/DOMWindow.cpp

Issue 203493005: Add more checks to prevent crashes when accessing name/opener properties (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase results Created 6 years, 9 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved.
3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 1171 matching lines...) Expand 10 before | Expand all | Expand 10 after
1182 unsigned DOMWindow::length() const 1182 unsigned DOMWindow::length() const
1183 { 1183 {
1184 if (!isCurrentlyDisplayedInFrame()) 1184 if (!isCurrentlyDisplayedInFrame())
1185 return 0; 1185 return 0;
1186 1186
1187 return m_frame->tree().scopedChildCount(); 1187 return m_frame->tree().scopedChildCount();
1188 } 1188 }
1189 1189
1190 const AtomicString& DOMWindow::name() const 1190 const AtomicString& DOMWindow::name() const
1191 { 1191 {
1192 if (!m_frame) 1192 if (!isCurrentlyDisplayedInFrame())
1193 return nullAtom; 1193 return nullAtom;
1194 1194
1195 return m_frame->tree().name(); 1195 return m_frame->tree().name();
1196 } 1196 }
1197 1197
1198 void DOMWindow::setName(const AtomicString& name) 1198 void DOMWindow::setName(const AtomicString& name)
1199 { 1199 {
1200 if (!m_frame) 1200 if (!isCurrentlyDisplayedInFrame())
1201 return; 1201 return;
1202 1202
1203 m_frame->tree().setName(name); 1203 m_frame->tree().setName(name);
1204 ASSERT(m_frame->loader().client());
1204 m_frame->loader().client()->didChangeName(name); 1205 m_frame->loader().client()->didChangeName(name);
1205 } 1206 }
1206 1207
1207 void DOMWindow::setStatus(const String& string) 1208 void DOMWindow::setStatus(const String& string)
1208 { 1209 {
1209 m_status = string; 1210 m_status = string;
1210 1211
1211 if (!m_frame) 1212 if (!m_frame)
1212 return; 1213 return;
1213 1214
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after
1860 return static_cast<DOMWindowLifecycleNotifier&>(LifecycleContext<DOMWindow>: :lifecycleNotifier()); 1861 return static_cast<DOMWindowLifecycleNotifier&>(LifecycleContext<DOMWindow>: :lifecycleNotifier());
1861 } 1862 }
1862 1863
1863 PassOwnPtr<LifecycleNotifier<DOMWindow> > DOMWindow::createLifecycleNotifier() 1864 PassOwnPtr<LifecycleNotifier<DOMWindow> > DOMWindow::createLifecycleNotifier()
1864 { 1865 {
1865 return DOMWindowLifecycleNotifier::create(this); 1866 return DOMWindowLifecycleNotifier::create(this);
1866 } 1867 }
1867 1868
1868 1869
1869 } // namespace WebCore 1870 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/fast/dom/Window/name-and-opener-on-detached-window-expected.txt ('k') | Source/core/loader/FrameLoader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698