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

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

Issue 799923006: Make canNavigate() OOPI-friendly (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years 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 994 matching lines...) Expand 10 before | Expand all | Expand 10 after
1005 Page* page = frame()->page(); 1005 Page* page = frame()->page();
1006 if (!page) 1006 if (!page)
1007 return; 1007 return;
1008 1008
1009 if (context) { 1009 if (context) {
1010 ASSERT(isMainThread()); 1010 ASSERT(isMainThread());
1011 Document* activeDocument = toDocument(context); 1011 Document* activeDocument = toDocument(context);
1012 if (!activeDocument) 1012 if (!activeDocument)
1013 return; 1013 return;
1014 1014
1015 if (!activeDocument->canNavigate(*frame())) 1015 if (!activeDocument->frame()->canNavigate(*frame()))
1016 return; 1016 return;
1017 } 1017 }
1018 1018
1019 Settings* settings = frame()->settings(); 1019 Settings* settings = frame()->settings();
1020 bool allowScriptsToCloseWindows = settings && settings->allowScriptsToCloseW indows(); 1020 bool allowScriptsToCloseWindows = settings && settings->allowScriptsToCloseW indows();
1021 1021
1022 if (!page->openedByDOM() && frame()->loader().client()->backForwardLength() > 1 && !allowScriptsToCloseWindows) { 1022 if (!page->openedByDOM() && frame()->loader().client()->backForwardLength() > 1 && !allowScriptsToCloseWindows) {
1023 frameConsole()->addMessage(ConsoleMessage::create(JSMessageSource, Warni ngMessageLevel, "Scripts may close only the windows that were opened by it.")); 1023 frameConsole()->addMessage(ConsoleMessage::create(JSMessageSource, Warni ngMessageLevel, "Scripts may close only the windows that were opened by it."));
1024 return; 1024 return;
1025 } 1025 }
(...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after
1713 void LocalDOMWindow::setLocation(const String& urlString, LocalDOMWindow* callin gWindow, LocalDOMWindow* enteredWindow, SetLocationLocking locking) 1713 void LocalDOMWindow::setLocation(const String& urlString, LocalDOMWindow* callin gWindow, LocalDOMWindow* enteredWindow, SetLocationLocking locking)
1714 { 1714 {
1715 if (!isCurrentlyDisplayedInFrame()) 1715 if (!isCurrentlyDisplayedInFrame())
1716 return; 1716 return;
1717 1717
1718 Document* activeDocument = callingWindow->document(); 1718 Document* activeDocument = callingWindow->document();
1719 if (!activeDocument) 1719 if (!activeDocument)
1720 return; 1720 return;
1721 1721
1722 ASSERT(frame()); 1722 ASSERT(frame());
1723 if (!activeDocument->canNavigate(*frame())) 1723 if (!activeDocument->frame() || !activeDocument->frame()->canNavigate(*frame ()))
1724 return; 1724 return;
1725 1725
1726 LocalFrame* firstFrame = enteredWindow->frame(); 1726 LocalFrame* firstFrame = enteredWindow->frame();
1727 if (!firstFrame) 1727 if (!firstFrame)
1728 return; 1728 return;
1729 1729
1730 KURL completedURL = firstFrame->document()->completeURL(urlString); 1730 KURL completedURL = firstFrame->document()->completeURL(urlString);
1731 if (completedURL.isNull()) 1731 if (completedURL.isNull())
1732 return; 1732 return;
1733 1733
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
1881 targetFrame = frame()->tree().top(); 1881 targetFrame = frame()->tree().top();
1882 else if (frameName == "_parent") { 1882 else if (frameName == "_parent") {
1883 if (Frame* parent = frame()->tree().parent()) 1883 if (Frame* parent = frame()->tree().parent())
1884 targetFrame = parent; 1884 targetFrame = parent;
1885 else 1885 else
1886 targetFrame = frame(); 1886 targetFrame = frame();
1887 } 1887 }
1888 // FIXME: Navigating RemoteFrames is not yet supported. 1888 // FIXME: Navigating RemoteFrames is not yet supported.
1889 if (targetFrame && targetFrame->isLocalFrame()) { 1889 if (targetFrame && targetFrame->isLocalFrame()) {
1890 LocalFrame* localTargetFrame = toLocalFrame(targetFrame); 1890 LocalFrame* localTargetFrame = toLocalFrame(targetFrame);
1891 if (!activeDocument->canNavigate(*localTargetFrame)) 1891 if (!activeDocument->frame()->canNavigate(*localTargetFrame))
1892 return nullptr; 1892 return nullptr;
1893 1893
1894 KURL completedURL = firstFrame->document()->completeURL(urlString); 1894 KURL completedURL = firstFrame->document()->completeURL(urlString);
1895 1895
1896 if (localTargetFrame->localDOMWindow()->isInsecureScriptAccess(*callingW indow, completedURL)) 1896 if (localTargetFrame->localDOMWindow()->isInsecureScriptAccess(*callingW indow, completedURL))
1897 return localTargetFrame->localDOMWindow(); 1897 return localTargetFrame->localDOMWindow();
1898 1898
1899 if (urlString.isEmpty()) 1899 if (urlString.isEmpty())
1900 return localTargetFrame->localDOMWindow(); 1900 return localTargetFrame->localDOMWindow();
1901 1901
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
1980 return m_frameObserver->frame(); 1980 return m_frameObserver->frame();
1981 } 1981 }
1982 1982
1983 v8::Handle<v8::Object> LocalDOMWindow::wrap(v8::Handle<v8::Object> creationConte xt, v8::Isolate* isolate) 1983 v8::Handle<v8::Object> LocalDOMWindow::wrap(v8::Handle<v8::Object> creationConte xt, v8::Isolate* isolate)
1984 { 1984 {
1985 ASSERT_NOT_REACHED(); // LocalDOMWindow has [Custom=ToV8]. 1985 ASSERT_NOT_REACHED(); // LocalDOMWindow has [Custom=ToV8].
1986 return v8::Handle<v8::Object>(); 1986 return v8::Handle<v8::Object>();
1987 } 1987 }
1988 1988
1989 } // namespace blink 1989 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698