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

Side by Side Diff: third_party/WebKit/Source/core/page/CreateWindow.cpp

Issue 2858963002: Replace ASSERT with DCHECK in core/ (Closed)
Patch Set: WorkerBackingThread 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 bool& created) { 76 bool& created) {
77 Page* old_page = opener_frame.GetPage(); 77 Page* old_page = opener_frame.GetPage();
78 if (!old_page) 78 if (!old_page)
79 return nullptr; 79 return nullptr;
80 80
81 Page* page = old_page->GetChromeClient().CreateWindow(&opener_frame, request, 81 Page* page = old_page->GetChromeClient().CreateWindow(&opener_frame, request,
82 features, policy); 82 features, policy);
83 if (!page) 83 if (!page)
84 return nullptr; 84 return nullptr;
85 85
86 ASSERT(page->MainFrame()); 86 DCHECK(page->MainFrame());
87 LocalFrame& frame = *ToLocalFrame(page->MainFrame()); 87 LocalFrame& frame = *ToLocalFrame(page->MainFrame());
88 88
89 if (!EqualIgnoringASCIICase(request.FrameName(), "_blank")) 89 if (!EqualIgnoringASCIICase(request.FrameName(), "_blank"))
90 frame.Tree().SetName(request.FrameName()); 90 frame.Tree().SetName(request.FrameName());
91 91
92 page->GetChromeClient().SetWindowFeatures(features); 92 page->GetChromeClient().SetWindowFeatures(features);
93 93
94 // 'x' and 'y' specify the location of the window, while 'width' and 'height' 94 // 'x' and 'y' specify the location of the window, while 'width' and 'height'
95 // specify the size of the viewport. We can only resize the window, so adjust 95 // specify the size of the viewport. We can only resize the window, so adjust
96 // for the difference between the window size and the viewport size. 96 // for the difference between the window size and the viewport size.
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 } 176 }
177 177
178 DOMWindow* CreateWindow(const String& url_string, 178 DOMWindow* CreateWindow(const String& url_string,
179 const AtomicString& frame_name, 179 const AtomicString& frame_name,
180 const WindowFeatures& window_features, 180 const WindowFeatures& window_features,
181 LocalDOMWindow& calling_window, 181 LocalDOMWindow& calling_window,
182 LocalFrame& first_frame, 182 LocalFrame& first_frame,
183 LocalFrame& opener_frame, 183 LocalFrame& opener_frame,
184 ExceptionState& exception_state) { 184 ExceptionState& exception_state) {
185 LocalFrame* active_frame = calling_window.GetFrame(); 185 LocalFrame* active_frame = calling_window.GetFrame();
186 ASSERT(active_frame); 186 DCHECK(active_frame);
187 187
188 KURL completed_url = url_string.IsEmpty() 188 KURL completed_url = url_string.IsEmpty()
189 ? KURL(kParsedURLString, g_empty_string) 189 ? KURL(kParsedURLString, g_empty_string)
190 : first_frame.GetDocument()->CompleteURL(url_string); 190 : first_frame.GetDocument()->CompleteURL(url_string);
191 if (!completed_url.IsEmpty() && !completed_url.IsValid()) { 191 if (!completed_url.IsEmpty() && !completed_url.IsValid()) {
192 UseCounter::Count(active_frame, UseCounter::kWindowOpenWithInvalidURL); 192 UseCounter::Count(active_frame, UseCounter::kWindowOpenWithInvalidURL);
193 exception_state.ThrowDOMException( 193 exception_state.ThrowDOMException(
194 kSyntaxError, "Unable to open a window with invalid URL '" + 194 kSyntaxError, "Unable to open a window with invalid URL '" +
195 completed_url.GetString() + "'.\n"); 195 completed_url.GetString() + "'.\n");
196 return nullptr; 196 return nullptr;
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 } 293 }
294 294
295 // TODO(japhet): Form submissions on RemoteFrames don't work yet. 295 // TODO(japhet): Form submissions on RemoteFrames don't work yet.
296 FrameLoadRequest new_request(0, request.GetResourceRequest()); 296 FrameLoadRequest new_request(0, request.GetResourceRequest());
297 new_request.SetForm(request.Form()); 297 new_request.SetForm(request.Form());
298 if (new_frame->IsLocalFrame()) 298 if (new_frame->IsLocalFrame())
299 ToLocalFrame(new_frame)->Loader().Load(new_request); 299 ToLocalFrame(new_frame)->Loader().Load(new_request);
300 } 300 }
301 301
302 } // namespace blink 302 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/page/ContextMenuController.cpp ('k') | third_party/WebKit/Source/core/page/Page.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698