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

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

Issue 22929032: Calling window.close() should indicate failure with warning message (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Patch for landing! Created 7 years, 1 month 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
« no previous file with comments | « no previous file | 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 874 matching lines...) Expand 10 before | Expand all | Expand 10 after
885 if (!activeDocument) 885 if (!activeDocument)
886 return; 886 return;
887 887
888 if (!activeDocument->canNavigate(m_frame)) 888 if (!activeDocument->canNavigate(m_frame))
889 return; 889 return;
890 } 890 }
891 891
892 Settings* settings = m_frame->settings(); 892 Settings* settings = m_frame->settings();
893 bool allowScriptsToCloseWindows = settings && settings->allowScriptsToCloseW indows(); 893 bool allowScriptsToCloseWindows = settings && settings->allowScriptsToCloseW indows();
894 894
895 if (!(page->openedByDOM() || page->backForward().backForwardListCount() <= 1 || allowScriptsToCloseWindows)) 895 if (!(page->openedByDOM() || page->backForward().backForwardListCount() <= 1 || allowScriptsToCloseWindows)) {
896 pageConsole()->addMessage(JSMessageSource, WarningMessageLevel, "Scripts may close only the windows that were opened by it.");
896 return; 897 return;
898 }
897 899
898 if (!m_frame->loader().shouldClose()) 900 if (!m_frame->loader().shouldClose())
899 return; 901 return;
900 902
901 page->chrome().closeWindowSoon(); 903 page->chrome().closeWindowSoon();
902 } 904 }
903 905
904 void DOMWindow::print() 906 void DOMWindow::print()
905 { 907 {
906 if (!m_frame) 908 if (!m_frame)
(...skipping 870 matching lines...) Expand 10 before | Expand all | Expand 10 after
1777 return static_cast<DOMWindowLifecycleNotifier&>(LifecycleContext::lifecycleN otifier()); 1779 return static_cast<DOMWindowLifecycleNotifier&>(LifecycleContext::lifecycleN otifier());
1778 } 1780 }
1779 1781
1780 PassOwnPtr<LifecycleNotifier<DOMWindow> > DOMWindow::createLifecycleNotifier() 1782 PassOwnPtr<LifecycleNotifier<DOMWindow> > DOMWindow::createLifecycleNotifier()
1781 { 1783 {
1782 return DOMWindowLifecycleNotifier::create(this); 1784 return DOMWindowLifecycleNotifier::create(this);
1783 } 1785 }
1784 1786
1785 1787
1786 } // namespace WebCore 1788 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698