Chromium Code Reviews| 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 994 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1701 void LocalDOMWindow::setLocation(const String& urlString, LocalDOMWindow* callin gWindow, LocalDOMWindow* enteredWindow, SetLocationLocking locking) | 1701 void LocalDOMWindow::setLocation(const String& urlString, LocalDOMWindow* callin gWindow, LocalDOMWindow* enteredWindow, SetLocationLocking locking) |
| 1702 { | 1702 { |
| 1703 if (!isCurrentlyDisplayedInFrame()) | 1703 if (!isCurrentlyDisplayedInFrame()) |
| 1704 return; | 1704 return; |
| 1705 | 1705 |
| 1706 Document* activeDocument = callingWindow->document(); | 1706 Document* activeDocument = callingWindow->document(); |
| 1707 if (!activeDocument) | 1707 if (!activeDocument) |
| 1708 return; | 1708 return; |
| 1709 | 1709 |
| 1710 ASSERT(frame()); | 1710 ASSERT(frame()); |
| 1711 if (!activeDocument->canNavigate(*frame())) | 1711 if (!activeDocument->frame() || !activeDocument->frame()->canNavigate(*frame ())) |
|
dcheng
2015/01/08 00:44:59
Why does this one require a null check of frame(),
Nate Chapin
2015/01/08 17:10:52
Um.....because this is the only one required to ma
dcheng
2015/01/08 23:20:19
Any chance you have a crash stack handy? I'm curio
| |
| 1712 return; | 1712 return; |
| 1713 | 1713 |
| 1714 LocalFrame* firstFrame = enteredWindow->frame(); | 1714 LocalFrame* firstFrame = enteredWindow->frame(); |
| 1715 if (!firstFrame) | 1715 if (!firstFrame) |
| 1716 return; | 1716 return; |
| 1717 | 1717 |
| 1718 KURL completedURL = firstFrame->document()->completeURL(urlString); | 1718 KURL completedURL = firstFrame->document()->completeURL(urlString); |
| 1719 if (completedURL.isNull()) | 1719 if (completedURL.isNull()) |
| 1720 return; | 1720 return; |
| 1721 | 1721 |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1869 targetFrame = frame()->tree().top(); | 1869 targetFrame = frame()->tree().top(); |
| 1870 else if (frameName == "_parent") { | 1870 else if (frameName == "_parent") { |
| 1871 if (Frame* parent = frame()->tree().parent()) | 1871 if (Frame* parent = frame()->tree().parent()) |
| 1872 targetFrame = parent; | 1872 targetFrame = parent; |
| 1873 else | 1873 else |
| 1874 targetFrame = frame(); | 1874 targetFrame = frame(); |
| 1875 } | 1875 } |
| 1876 // FIXME: Navigating RemoteFrames is not yet supported. | 1876 // FIXME: Navigating RemoteFrames is not yet supported. |
| 1877 if (targetFrame && targetFrame->isLocalFrame()) { | 1877 if (targetFrame && targetFrame->isLocalFrame()) { |
| 1878 LocalFrame* localTargetFrame = toLocalFrame(targetFrame); | 1878 LocalFrame* localTargetFrame = toLocalFrame(targetFrame); |
| 1879 if (!activeDocument->canNavigate(*localTargetFrame)) | 1879 if (!activeDocument->frame()->canNavigate(*localTargetFrame)) |
| 1880 return nullptr; | 1880 return nullptr; |
| 1881 | 1881 |
| 1882 KURL completedURL = firstFrame->document()->completeURL(urlString); | 1882 KURL completedURL = firstFrame->document()->completeURL(urlString); |
| 1883 | 1883 |
| 1884 if (localTargetFrame->localDOMWindow()->isInsecureScriptAccess(*callingW indow, completedURL)) | 1884 if (localTargetFrame->localDOMWindow()->isInsecureScriptAccess(*callingW indow, completedURL)) |
| 1885 return localTargetFrame->localDOMWindow(); | 1885 return localTargetFrame->localDOMWindow(); |
| 1886 | 1886 |
| 1887 if (urlString.isEmpty()) | 1887 if (urlString.isEmpty()) |
| 1888 return localTargetFrame->localDOMWindow(); | 1888 return localTargetFrame->localDOMWindow(); |
| 1889 | 1889 |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1968 return m_frameObserver->frame(); | 1968 return m_frameObserver->frame(); |
| 1969 } | 1969 } |
| 1970 | 1970 |
| 1971 v8::Handle<v8::Object> LocalDOMWindow::wrap(v8::Handle<v8::Object> creationConte xt, v8::Isolate* isolate) | 1971 v8::Handle<v8::Object> LocalDOMWindow::wrap(v8::Handle<v8::Object> creationConte xt, v8::Isolate* isolate) |
| 1972 { | 1972 { |
| 1973 ASSERT_NOT_REACHED(); // LocalDOMWindow has [Custom=ToV8]. | 1973 ASSERT_NOT_REACHED(); // LocalDOMWindow has [Custom=ToV8]. |
| 1974 return v8::Handle<v8::Object>(); | 1974 return v8::Handle<v8::Object>(); |
| 1975 } | 1975 } |
| 1976 | 1976 |
| 1977 } // namespace blink | 1977 } // namespace blink |
| OLD | NEW |