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

Side by Side Diff: third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp

Issue 2053903002: Returning early when setting a frame name to the same name. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Replacing part of short-circuiting condition with just an assert. Created 4 years, 6 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
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 1038 matching lines...) Expand 10 before | Expand all | Expand 10 after
1049 return nullAtom; 1049 return nullAtom;
1050 1050
1051 return frame()->tree().name(); 1051 return frame()->tree().name();
1052 } 1052 }
1053 1053
1054 void LocalDOMWindow::setName(const AtomicString& name) 1054 void LocalDOMWindow::setName(const AtomicString& name)
1055 { 1055 {
1056 if (!isCurrentlyDisplayedInFrame()) 1056 if (!isCurrentlyDisplayedInFrame())
1057 return; 1057 return;
1058 1058
1059 if (name == frame()->tree().name())
1060 return;
1061
1059 frame()->tree().setName(name); 1062 frame()->tree().setName(name);
1060 ASSERT(frame()->loader().client()); 1063 ASSERT(frame()->loader().client());
1061 frame()->loader().client()->didChangeName(name, frame()->tree().uniqueName() ); 1064 frame()->loader().client()->didChangeName(name, frame()->tree().uniqueName() );
dcheng 2016/06/15 11:18:35 I'd suggest moving this into FrameTree::setName()
Łukasz Anforowicz 2016/06/15 17:46:22 I think this is a great idea. At the same time, I
1062 } 1065 }
1063 1066
1064 void LocalDOMWindow::setStatus(const String& string) 1067 void LocalDOMWindow::setStatus(const String& string)
1065 { 1068 {
1066 m_status = string; 1069 m_status = string;
1067 1070
1068 if (!frame()) 1071 if (!frame())
1069 return; 1072 return;
1070 1073
1071 FrameHost* host = frame()->host(); 1074 FrameHost* host = frame()->host();
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
1550 { 1553 {
1551 // If the LocalDOMWindow still has a frame reference, that frame must point 1554 // If the LocalDOMWindow still has a frame reference, that frame must point
1552 // back to this LocalDOMWindow: otherwise, it's easy to get into a situation 1555 // back to this LocalDOMWindow: otherwise, it's easy to get into a situation
1553 // where script execution leaks between different LocalDOMWindows. 1556 // where script execution leaks between different LocalDOMWindows.
1554 if (m_frameObserver->frame()) 1557 if (m_frameObserver->frame())
1555 ASSERT_WITH_SECURITY_IMPLICATION(m_frameObserver->frame()->domWindow() = = this); 1558 ASSERT_WITH_SECURITY_IMPLICATION(m_frameObserver->frame()->domWindow() = = this);
1556 return m_frameObserver->frame(); 1559 return m_frameObserver->frame();
1557 } 1560 }
1558 1561
1559 } // namespace blink 1562 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698