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

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

Issue 14735005: Disallow a window focusing itself via javascript URLs or using target _self (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 7 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 | « Source/core/loader/FrameLoader.cpp ('k') | no next file » | 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) 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 842 matching lines...) Expand 10 before | Expand all | Expand 10 after
853 return; 853 return;
854 854
855 Page* page = m_frame->page(); 855 Page* page = m_frame->page();
856 if (!page) 856 if (!page)
857 return; 857 return;
858 858
859 bool allowFocus = WindowFocusAllowedIndicator::windowFocusAllowed(); 859 bool allowFocus = WindowFocusAllowedIndicator::windowFocusAllowed();
860 if (context) { 860 if (context) {
861 ASSERT(isMainThread()); 861 ASSERT(isMainThread());
862 Document* activeDocument = toDocument(context); 862 Document* activeDocument = toDocument(context);
863 if (opener() && activeDocument->domWindow() == opener()) 863 if (opener() && opener() != this && activeDocument->domWindow() == opene r())
864 allowFocus = true; 864 allowFocus = true;
865 } 865 }
866 866
867 // If we're a top level window, bring the window to the front. 867 // If we're a top level window, bring the window to the front.
868 if (m_frame == page->mainFrame() && allowFocus) 868 if (m_frame == page->mainFrame() && allowFocus)
869 page->chrome()->focus(); 869 page->chrome()->focus();
870 870
871 if (!m_frame) 871 if (!m_frame)
872 return; 872 return;
873 873
(...skipping 1003 matching lines...) Expand 10 before | Expand all | Expand 10 after
1877 WindowFeatures windowFeatures(dialogFeaturesString, screenAvailableRect(m_fr ame->view())); 1877 WindowFeatures windowFeatures(dialogFeaturesString, screenAvailableRect(m_fr ame->view()));
1878 Frame* dialogFrame = createWindow(urlString, emptyAtom, windowFeatures, 1878 Frame* dialogFrame = createWindow(urlString, emptyAtom, windowFeatures,
1879 activeWindow, firstFrame, m_frame, function, functionContext); 1879 activeWindow, firstFrame, m_frame, function, functionContext);
1880 if (!dialogFrame) 1880 if (!dialogFrame)
1881 return; 1881 return;
1882 UserGestureIndicatorDisabler disabler; 1882 UserGestureIndicatorDisabler disabler;
1883 dialogFrame->page()->chrome()->runModal(); 1883 dialogFrame->page()->chrome()->runModal();
1884 } 1884 }
1885 1885
1886 } // namespace WebCore 1886 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/loader/FrameLoader.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698