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

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

Issue 2855263004: Throw in window.open() when an invalid URL is being passed (Closed)
Patch Set: updates Created 3 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
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 1591 matching lines...) Expand 10 before | Expand all | Expand 10 after
1602 return; 1602 return;
1603 1603
1604 GetFrameConsole()->AddMessage( 1604 GetFrameConsole()->AddMessage(
1605 ConsoleMessage::Create(kJSMessageSource, kErrorMessageLevel, message)); 1605 ConsoleMessage::Create(kJSMessageSource, kErrorMessageLevel, message));
1606 } 1606 }
1607 1607
1608 DOMWindow* LocalDOMWindow::open(const String& url_string, 1608 DOMWindow* LocalDOMWindow::open(const String& url_string,
1609 const AtomicString& frame_name, 1609 const AtomicString& frame_name,
1610 const String& window_features_string, 1610 const String& window_features_string,
1611 LocalDOMWindow* calling_window, 1611 LocalDOMWindow* calling_window,
1612 LocalDOMWindow* entered_window) { 1612 LocalDOMWindow* entered_window,
1613 ExceptionState& exception_state) {
1613 if (!IsCurrentlyDisplayedInFrame()) 1614 if (!IsCurrentlyDisplayedInFrame())
1614 return nullptr; 1615 return nullptr;
1615 if (!calling_window->GetFrame()) 1616 if (!calling_window->GetFrame())
1616 return nullptr; 1617 return nullptr;
1617 Document* active_document = calling_window->document(); 1618 Document* active_document = calling_window->document();
1618 if (!active_document) 1619 if (!active_document)
1619 return nullptr; 1620 return nullptr;
1620 LocalFrame* first_frame = entered_window->GetFrame(); 1621 LocalFrame* first_frame = entered_window->GetFrame();
1621 if (!first_frame) 1622 if (!first_frame)
1622 return nullptr; 1623 return nullptr;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
1660 return target_frame->DomWindow(); 1661 return target_frame->DomWindow();
1661 1662
1662 target_frame->Navigate(*active_document, completed_url, false, 1663 target_frame->Navigate(*active_document, completed_url, false,
1663 UserGestureStatus::kNone); 1664 UserGestureStatus::kNone);
1664 return target_frame->DomWindow(); 1665 return target_frame->DomWindow();
1665 } 1666 }
1666 1667
1667 WindowFeatures features(window_features_string); 1668 WindowFeatures features(window_features_string);
1668 DOMWindow* new_window = 1669 DOMWindow* new_window =
1669 CreateWindow(url_string, frame_name, features, *calling_window, 1670 CreateWindow(url_string, frame_name, features, *calling_window,
1670 *first_frame, *GetFrame()); 1671 *first_frame, *GetFrame(), exception_state);
1671 return features.noopener ? nullptr : new_window; 1672 return features.noopener ? nullptr : new_window;
1672 } 1673 }
1673 1674
1674 DEFINE_TRACE(LocalDOMWindow) { 1675 DEFINE_TRACE(LocalDOMWindow) {
1675 visitor->Trace(document_); 1676 visitor->Trace(document_);
1676 visitor->Trace(screen_); 1677 visitor->Trace(screen_);
1677 visitor->Trace(history_); 1678 visitor->Trace(history_);
1678 visitor->Trace(locationbar_); 1679 visitor->Trace(locationbar_);
1679 visitor->Trace(menubar_); 1680 visitor->Trace(menubar_);
1680 visitor->Trace(personalbar_); 1681 visitor->Trace(personalbar_);
(...skipping 12 matching lines...) Expand all
1693 DOMWindow::Trace(visitor); 1694 DOMWindow::Trace(visitor);
1694 Supplementable<LocalDOMWindow>::Trace(visitor); 1695 Supplementable<LocalDOMWindow>::Trace(visitor);
1695 } 1696 }
1696 1697
1697 DEFINE_TRACE_WRAPPERS(LocalDOMWindow) { 1698 DEFINE_TRACE_WRAPPERS(LocalDOMWindow) {
1698 visitor->TraceWrappers(custom_elements_); 1699 visitor->TraceWrappers(custom_elements_);
1699 DOMWindow::TraceWrappers(visitor); 1700 DOMWindow::TraceWrappers(visitor);
1700 } 1701 }
1701 1702
1702 } // namespace blink 1703 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698