OLD | NEW |
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 1000 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1011 Page* page = frame()->page(); | 1011 Page* page = frame()->page(); |
1012 if (!page) | 1012 if (!page) |
1013 return; | 1013 return; |
1014 | 1014 |
1015 if (context) { | 1015 if (context) { |
1016 ASSERT(isMainThread()); | 1016 ASSERT(isMainThread()); |
1017 Document* activeDocument = toDocument(context); | 1017 Document* activeDocument = toDocument(context); |
1018 if (!activeDocument) | 1018 if (!activeDocument) |
1019 return; | 1019 return; |
1020 | 1020 |
1021 if (!activeDocument->canNavigate(*frame())) | 1021 if (!activeDocument->frame() || !activeDocument->frame()->canNavigate(*f
rame())) |
1022 return; | 1022 return; |
1023 } | 1023 } |
1024 | 1024 |
1025 Settings* settings = frame()->settings(); | 1025 Settings* settings = frame()->settings(); |
1026 bool allowScriptsToCloseWindows = settings && settings->allowScriptsToCloseW
indows(); | 1026 bool allowScriptsToCloseWindows = settings && settings->allowScriptsToCloseW
indows(); |
1027 | 1027 |
1028 if (!page->openedByDOM() && frame()->loader().client()->backForwardLength()
> 1 && !allowScriptsToCloseWindows) { | 1028 if (!page->openedByDOM() && frame()->loader().client()->backForwardLength()
> 1 && !allowScriptsToCloseWindows) { |
1029 frameConsole()->addMessage(ConsoleMessage::create(JSMessageSource, Warni
ngMessageLevel, "Scripts may close only the windows that were opened by it.")); | 1029 frameConsole()->addMessage(ConsoleMessage::create(JSMessageSource, Warni
ngMessageLevel, "Scripts may close only the windows that were opened by it.")); |
1030 return; | 1030 return; |
1031 } | 1031 } |
(...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1708 void LocalDOMWindow::setLocation(const String& urlString, LocalDOMWindow* callin
gWindow, LocalDOMWindow* enteredWindow, SetLocationLocking locking) | 1708 void LocalDOMWindow::setLocation(const String& urlString, LocalDOMWindow* callin
gWindow, LocalDOMWindow* enteredWindow, SetLocationLocking locking) |
1709 { | 1709 { |
1710 if (!isCurrentlyDisplayedInFrame()) | 1710 if (!isCurrentlyDisplayedInFrame()) |
1711 return; | 1711 return; |
1712 | 1712 |
1713 Document* activeDocument = callingWindow->document(); | 1713 Document* activeDocument = callingWindow->document(); |
1714 if (!activeDocument) | 1714 if (!activeDocument) |
1715 return; | 1715 return; |
1716 | 1716 |
1717 ASSERT(frame()); | 1717 ASSERT(frame()); |
1718 if (!activeDocument->canNavigate(*frame())) | 1718 if (!activeDocument->frame() || !activeDocument->frame()->canNavigate(*frame
())) |
1719 return; | 1719 return; |
1720 | 1720 |
1721 LocalFrame* firstFrame = enteredWindow->frame(); | 1721 LocalFrame* firstFrame = enteredWindow->frame(); |
1722 if (!firstFrame) | 1722 if (!firstFrame) |
1723 return; | 1723 return; |
1724 | 1724 |
1725 KURL completedURL = firstFrame->document()->completeURL(urlString); | 1725 KURL completedURL = firstFrame->document()->completeURL(urlString); |
1726 if (completedURL.isNull()) | 1726 if (completedURL.isNull()) |
1727 return; | 1727 return; |
1728 | 1728 |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1876 targetFrame = frame()->tree().top(); | 1876 targetFrame = frame()->tree().top(); |
1877 else if (frameName == "_parent") { | 1877 else if (frameName == "_parent") { |
1878 if (Frame* parent = frame()->tree().parent()) | 1878 if (Frame* parent = frame()->tree().parent()) |
1879 targetFrame = parent; | 1879 targetFrame = parent; |
1880 else | 1880 else |
1881 targetFrame = frame(); | 1881 targetFrame = frame(); |
1882 } | 1882 } |
1883 // FIXME: Navigating RemoteFrames is not yet supported. | 1883 // FIXME: Navigating RemoteFrames is not yet supported. |
1884 if (targetFrame && targetFrame->isLocalFrame()) { | 1884 if (targetFrame && targetFrame->isLocalFrame()) { |
1885 LocalFrame* localTargetFrame = toLocalFrame(targetFrame); | 1885 LocalFrame* localTargetFrame = toLocalFrame(targetFrame); |
1886 if (!activeDocument->canNavigate(*localTargetFrame)) | 1886 if (!activeDocument->frame() || !activeDocument->frame()->canNavigate(*l
ocalTargetFrame)) |
1887 return nullptr; | 1887 return nullptr; |
1888 | 1888 |
1889 KURL completedURL = firstFrame->document()->completeURL(urlString); | 1889 KURL completedURL = firstFrame->document()->completeURL(urlString); |
1890 | 1890 |
1891 if (localTargetFrame->localDOMWindow()->isInsecureScriptAccess(*callingW
indow, completedURL)) | 1891 if (localTargetFrame->localDOMWindow()->isInsecureScriptAccess(*callingW
indow, completedURL)) |
1892 return localTargetFrame->localDOMWindow(); | 1892 return localTargetFrame->localDOMWindow(); |
1893 | 1893 |
1894 if (urlString.isEmpty()) | 1894 if (urlString.isEmpty()) |
1895 return localTargetFrame->localDOMWindow(); | 1895 return localTargetFrame->localDOMWindow(); |
1896 | 1896 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1975 return m_frameObserver->frame(); | 1975 return m_frameObserver->frame(); |
1976 } | 1976 } |
1977 | 1977 |
1978 v8::Handle<v8::Object> LocalDOMWindow::wrap(v8::Handle<v8::Object> creationConte
xt, v8::Isolate* isolate) | 1978 v8::Handle<v8::Object> LocalDOMWindow::wrap(v8::Handle<v8::Object> creationConte
xt, v8::Isolate* isolate) |
1979 { | 1979 { |
1980 ASSERT_NOT_REACHED(); // LocalDOMWindow has [Custom=ToV8]. | 1980 ASSERT_NOT_REACHED(); // LocalDOMWindow has [Custom=ToV8]. |
1981 return v8::Handle<v8::Object>(); | 1981 return v8::Handle<v8::Object>(); |
1982 } | 1982 } |
1983 | 1983 |
1984 } // namespace blink | 1984 } // namespace blink |
OLD | NEW |