Changeset 150282 in webkit
- Timestamp:
- May 17, 2013, 12:15:45 PM (12 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r150277 r150282 1 2013-05-17 Brady Eidson <beidson@apple.com> 2 3 Replace WebFrameLoaderClient static_casts with a function that might return null. 4 https://bugs.webkit.org/show_bug.cgi?id=116253 5 6 The general approach here is: 7 1 - Introduce a toWebFrameLoaderClient() function to convert FrameLoaderClients, and that may return null. 8 2 - Adopt toWebFrameLoaderClient() everywhere we used to do a direct static_cast<WebFrameLoaderClient*> 9 3 - In functions that already support a "return 0" scenario, a failed cast results in a return 0. 10 4 - In other functions that assume no failure to get the WebFrameLoaderClient, add an ASSERT. 11 12 Reviewed by Alexey Proskuryakov. 13 14 Add the utility function to cast: 15 * WebProcess/WebCoreSupport/WebFrameLoaderClient.h: 16 (WebKit::toWebFrameLoaderClient): 17 18 Adopt it everywhere: 19 * WebProcess/Geolocation/GeolocationPermissionRequestManager.cpp: 20 (WebKit::GeolocationPermissionRequestManager::startRequestForGeolocation): 21 22 * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp: 23 (WebKit::InjectedBundleNodeHandle::documentFrame): 24 (WebKit::InjectedBundleNodeHandle::htmlFrameElementContentFrame): 25 (WebKit::InjectedBundleNodeHandle::htmlIFrameElementContentFrame): 26 27 * WebProcess/InjectedBundle/InjectedBundle.cpp: 28 (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner): 29 30 * WebProcess/InjectedBundle/InjectedBundleDOMWindowExtension.cpp: 31 (WebKit::InjectedBundleDOMWindowExtension::frame): 32 33 * WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp: 34 (WebKit::InjectedBundleHitTestResult::frame): 35 (WebKit::InjectedBundleHitTestResult::targetFrame): 36 37 * WebProcess/Network/WebResourceLoadScheduler.cpp: 38 (WebKit::WebResourceLoadScheduler::scheduleLoad): 39 40 * WebProcess/Plugins/PluginView.cpp: 41 (WebKit::webPage): 42 (WebKit::PluginView::performFrameLoadURLRequest): 43 44 * WebProcess/WebCoreSupport/WebChromeClient.cpp: 45 (WebKit::WebChromeClient::focusedNodeChanged): 46 (WebKit::WebChromeClient::focusedFrameChanged): 47 (WebKit::WebChromeClient::runBeforeUnloadConfirmPanel): 48 (WebKit::WebChromeClient::runJavaScriptAlert): 49 (WebKit::WebChromeClient::runJavaScriptConfirm): 50 (WebKit::WebChromeClient::runJavaScriptPrompt): 51 (WebKit::WebChromeClient::print): 52 (WebKit::WebChromeClient::exceededDatabaseQuota): 53 (WebKit::WebChromeClient::runOpenPanel): 54 55 * WebProcess/WebCoreSupport/WebEditorClient.cpp: 56 (WebKit::WebEditorClient::textFieldDidBeginEditing): 57 (WebKit::WebEditorClient::textFieldDidEndEditing): 58 (WebKit::WebEditorClient::textDidChangeInTextField): 59 (WebKit::WebEditorClient::textDidChangeInTextArea): 60 (WebKit::WebEditorClient::doTextFieldCommandFromEvent): 61 (WebKit::WebEditorClient::textWillBeDeletedInTextField): 62 63 * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: 64 (WebKit::WebFrameLoaderClient::dispatchWillSendSubmitEvent): 65 (WebKit::WebFrameLoaderClient::dispatchWillSubmitForm): 66 67 * WebProcess/WebPage/WebFrame.cpp: 68 (WebKit::WebFrame::contentsAsString): 69 (WebKit::WebFrame::parentFrame): 70 (WebKit::WebFrame::childFrames): 71 (WebKit::WebFrame::frameForContext): 72 (WebKit::WebFrameFilter::shouldIncludeSubframe): 73 74 * WebProcess/WebPage/WebPage.cpp: 75 (WebKit::WebPage::mainFrameHasCustomRepresentation): 76 1 77 2013-05-17 Sam Weinig <sam@webkit.org> 2 78 -
trunk/Source/WebKit2/WebProcess/Geolocation/GeolocationPermissionRequestManager.cpp
r144568 r150282 63 63 Frame* frame = geolocation->frame(); 64 64 65 WebFrame* webFrame = static_cast<WebFrameLoaderClient*>(frame->loader()->client())->webFrame(); 65 WebFrameLoaderClient* webFrameLoaderClient = toWebFrameLoaderClient(frame->loader()->client()); 66 WebFrame* webFrame = webFrameLoaderClient ? webFrameLoaderClient->webFrame() : 0; 67 ASSERT(webFrame); 68 66 69 SecurityOrigin* origin = frame->document()->securityOrigin(); 67 70 -
trunk/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp
r148238 r150282 236 236 return 0; 237 237 238 return static_cast<WebFrameLoaderClient*>(frame->loader()->client())->webFrame(); 238 WebFrameLoaderClient* webFrameLoaderClient = toWebFrameLoaderClient(frame->loader()->client()); 239 return webFrameLoaderClient ? webFrameLoaderClient->webFrame() : 0; 239 240 } 240 241 … … 248 249 return 0; 249 250 250 return static_cast<WebFrameLoaderClient*>(frame->loader()->client())->webFrame(); 251 WebFrameLoaderClient* webFrameLoaderClient = toWebFrameLoaderClient(frame->loader()->client()); 252 return webFrameLoaderClient ? webFrameLoaderClient->webFrame() : 0; 251 253 } 252 254 … … 260 262 return 0; 261 263 262 return static_cast<WebFrameLoaderClient*>(frame->loader()->client())->webFrame(); 264 WebFrameLoaderClient* webFrameLoaderClient = toWebFrameLoaderClient(frame->loader()->client()); 265 return webFrameLoaderClient ? webFrameLoaderClient->webFrame() : 0; 263 266 } 264 267 -
trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp
r149848 r150282 162 162 163 163 if (preference == "WebKitTabToLinksPreferenceKey") { 164 WebPreferencesStore::overrideBoolValueForKey(WebPreferencesKey::tabsToLinksKey(), enabled); 165 for (HashSet<Page*>::iterator i = pages.begin(); i != pages.end(); ++i) { 166 WebPage* webPage = static_cast<WebFrameLoaderClient*>((*i)->mainFrame()->loader()->client())->webFrame()->page(); 167 webPage->setTabToLinksEnabled(enabled); 164 WebPreferencesStore::overrideBoolValueForKey(WebPreferencesKey::tabsToLinksKey(), enabled); 165 for (HashSet<Page*>::iterator i = pages.begin(); i != pages.end(); ++i) { 166 WebFrameLoaderClient* webFrameLoaderClient = toWebFrameLoaderClient((*i)->mainFrame()->loader()->client()); 167 ASSERT(webFrameLoaderClient); 168 webFrameLoaderClient->webFrame()->page()->setTabToLinksEnabled(enabled); 168 169 } 169 170 } … … 172 173 WebPreferencesStore::overrideBoolValueForKey(WebPreferencesKey::asynchronousPluginInitializationEnabledKey(), enabled); 173 174 for (HashSet<Page*>::iterator i = pages.begin(); i != pages.end(); ++i) { 174 WebPage* webPage = static_cast<WebFrameLoaderClient*>((*i)->mainFrame()->loader()->client())->webFrame()->page(); 175 webPage->setAsynchronousPluginInitializationEnabled(enabled); 175 WebFrameLoaderClient* webFrameLoaderClient = toWebFrameLoaderClient((*i)->mainFrame()->loader()->client()); 176 ASSERT(webFrameLoaderClient); 177 webFrameLoaderClient->webFrame()->page()->setAsynchronousPluginInitializationEnabled(enabled); 176 178 } 177 179 } … … 180 182 WebPreferencesStore::overrideBoolValueForKey(WebPreferencesKey::asynchronousPluginInitializationEnabledForAllPluginsKey(), enabled); 181 183 for (HashSet<Page*>::iterator i = pages.begin(); i != pages.end(); ++i) { 182 WebPage* webPage = static_cast<WebFrameLoaderClient*>((*i)->mainFrame()->loader()->client())->webFrame()->page(); 183 webPage->setAsynchronousPluginInitializationEnabledForAllPlugins(enabled); 184 WebFrameLoaderClient* webFrameLoaderClient = toWebFrameLoaderClient((*i)->mainFrame()->loader()->client()); 185 ASSERT(webFrameLoaderClient); 186 webFrameLoaderClient->webFrame()->page()->setAsynchronousPluginInitializationEnabledForAllPlugins(enabled); 184 187 } 185 188 } … … 188 191 WebPreferencesStore::overrideBoolValueForKey(WebPreferencesKey::artificialPluginInitializationDelayEnabledKey(), enabled); 189 192 for (HashSet<Page*>::iterator i = pages.begin(); i != pages.end(); ++i) { 190 WebPage* webPage = static_cast<WebFrameLoaderClient*>((*i)->mainFrame()->loader()->client())->webFrame()->page(); 191 webPage->setArtificialPluginInitializationDelayEnabled(enabled); 193 WebFrameLoaderClient* webFrameLoaderClient = toWebFrameLoaderClient((*i)->mainFrame()->loader()->client()); 194 ASSERT(webFrameLoaderClient); 195 webFrameLoaderClient->webFrame()->page()->setArtificialPluginInitializationDelayEnabled(enabled); 192 196 } 193 197 } -
trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleDOMWindowExtension.cpp
r148373 r150282 72 72 WebFrame* InjectedBundleDOMWindowExtension::frame() const 73 73 { 74 WebCore::Frame* frame = m_coreExtension->frame(); 75 return frame ? static_cast<WebFrameLoaderClient*>(frame->loader()->client())->webFrame() : 0; 74 Frame* frame = m_coreExtension->frame(); 75 WebFrameLoaderClient* webFrameLoaderClient = frame ? toWebFrameLoaderClient(frame->loader()->client()) : 0; 76 return webFrameLoaderClient ? webFrameLoaderClient->webFrame() : 0; 76 77 } 77 78 -
trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp
r97810 r150282 65 65 return 0; 66 66 67 return static_cast<WebFrameLoaderClient*>(frame->loader()->client())->webFrame(); 67 WebFrameLoaderClient* webFrameLoaderClient = toWebFrameLoaderClient(frame->loader()->client()); 68 return webFrameLoaderClient ? webFrameLoaderClient->webFrame() : 0; 68 69 } 69 70 … … 74 75 return 0; 75 76 76 return static_cast<WebFrameLoaderClient*>(frame->loader()->client())->webFrame(); 77 WebFrameLoaderClient* webFrameLoaderClient = toWebFrameLoaderClient(frame->loader()->client()); 78 return webFrameLoaderClient ? webFrameLoaderClient->webFrame() : 0; 77 79 } 78 80 -
trunk/Source/WebKit2/WebProcess/Network/WebResourceLoadScheduler.cpp
r150206 r150282 109 109 // EmptyFrameLoaderClient shouldn't exist and everything should be using a WebFrameLoaderClient, 110 110 // but in the meantime we have to make sure not to mis-cast. 111 WebFrame* webFrame = 0; 112 WebPage* webPage = 0; 113 if (!resourceLoader->frameLoader()->client()->isEmptyFrameLoaderClient()) { 114 webFrame = static_cast<WebFrameLoaderClient*>(resourceLoader->frameLoader()->client())->webFrame(); 115 webPage = webFrame->page(); 116 } 111 WebFrameLoaderClient* webFrameLoaderClient = toWebFrameLoaderClient(resourceLoader->frameLoader()->client()); 112 WebFrame* webFrame = webFrameLoaderClient ? webFrameLoaderClient->webFrame() : 0; 113 WebPage* webPage = webFrame ? webFrame->page() : 0; 117 114 118 115 NetworkResourceLoadParameters loadParameters; -
trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp
r150214 r150282 254 254 ASSERT(frame); 255 255 256 WebPage* webPage = static_cast<WebFrameLoaderClient*>(frame->loader()->client())->webFrame()->page(); 256 WebFrameLoaderClient* webFrameLoaderClient = toWebFrameLoaderClient(frame->loader()->client()); 257 WebPage* webPage = webFrameLoaderClient ? webFrameLoaderClient->webFrame()->page() : 0; 257 258 ASSERT(webPage); 258 259 … … 1104 1105 targetFrame->loader()->load(FrameLoadRequest(targetFrame, request->request())); 1105 1106 1106 WebFrame* targetWebFrame = static_cast<WebFrameLoaderClient*>(targetFrame->loader()->client())->webFrame(); 1107 WebFrameLoaderClient* webFrameLoaderClient = toWebFrameLoaderClient(targetFrame->loader()->client()); 1108 WebFrame* targetWebFrame = webFrameLoaderClient ? webFrameLoaderClient->webFrame() : 0; 1109 ASSERT(targetWebFrame); 1110 1107 1111 if (WebFrame::LoadListener* loadListener = targetWebFrame->loadListener()) { 1108 1112 // Check if another plug-in view or even this view is waiting for the frame to load. -
trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp
r149971 r150282 171 171 return; 172 172 173 WebFrame* webFrame = static_cast<WebFrameLoaderClient*>(node->document()->frame()->loader()->client())->webFrame(); 173 WebFrameLoaderClient* webFrameLoaderClient = toWebFrameLoaderClient(node->document()->frame()->loader()->client()); 174 WebFrame* webFrame = webFrameLoaderClient ? webFrameLoaderClient->webFrame() : 0; 175 ASSERT(webFrame); 174 176 m_page->injectedBundleFormClient().didFocusTextField(m_page, inputElement, webFrame); 175 177 } … … 177 179 void WebChromeClient::focusedFrameChanged(Frame* frame) 178 180 { 179 WebFrame* webFrame = frame ? static_cast<WebFrameLoaderClient*>(frame->loader()->client())->webFrame() : 0; 181 WebFrameLoaderClient* webFrameLoaderClient = toWebFrameLoaderClient(frame->loader()->client()); 182 WebFrame* webFrame = webFrameLoaderClient ? webFrameLoaderClient->webFrame() : 0; 180 183 181 184 WebProcess::shared().connection()->send(Messages::WebPageProxy::FocusedFrameChanged(webFrame ? webFrame->frameID() : 0), m_page->pageID()); … … 299 302 bool WebChromeClient::runBeforeUnloadConfirmPanel(const String& message, Frame* frame) 300 303 { 301 WebFrame* webFrame = static_cast<WebFrameLoaderClient*>(frame->loader()->client())->webFrame(); 304 WebFrameLoaderClient* webFrameLoaderClient = toWebFrameLoaderClient(frame->loader()->client()); 305 WebFrame* webFrame = webFrameLoaderClient ? webFrameLoaderClient->webFrame() : 0; 306 ASSERT(webFrame); 302 307 303 308 bool shouldClose = false; … … 329 334 void WebChromeClient::runJavaScriptAlert(Frame* frame, const String& alertText) 330 335 { 331 WebFrame* webFrame = static_cast<WebFrameLoaderClient*>(frame->loader()->client())->webFrame(); 336 WebFrameLoaderClient* webFrameLoaderClient = toWebFrameLoaderClient(frame->loader()->client()); 337 WebFrame* webFrame = webFrameLoaderClient ? webFrameLoaderClient->webFrame() : 0; 338 ASSERT(webFrame); 332 339 333 340 // Notify the bundle client. … … 340 347 bool WebChromeClient::runJavaScriptConfirm(Frame* frame, const String& message) 341 348 { 342 WebFrame* webFrame = static_cast<WebFrameLoaderClient*>(frame->loader()->client())->webFrame(); 349 WebFrameLoaderClient* webFrameLoaderClient = toWebFrameLoaderClient(frame->loader()->client()); 350 WebFrame* webFrame = webFrameLoaderClient ? webFrameLoaderClient->webFrame() : 0; 351 ASSERT(webFrame); 343 352 344 353 // Notify the bundle client. … … 355 364 bool WebChromeClient::runJavaScriptPrompt(Frame* frame, const String& message, const String& defaultValue, String& result) 356 365 { 357 WebFrame* webFrame = static_cast<WebFrameLoaderClient*>(frame->loader()->client())->webFrame(); 366 WebFrameLoaderClient* webFrameLoaderClient = toWebFrameLoaderClient(frame->loader()->client()); 367 WebFrame* webFrame = webFrameLoaderClient ? webFrameLoaderClient->webFrame() : 0; 368 ASSERT(webFrame); 358 369 359 370 // Notify the bundle client. … … 560 571 void WebChromeClient::print(Frame* frame) 561 572 { 562 WebFrame* webFrame = static_cast<WebFrameLoaderClient*>(frame->loader()->client())->webFrame(); 573 WebFrameLoaderClient* webFrameLoaderClient = toWebFrameLoaderClient(frame->loader()->client()); 574 WebFrame* webFrame = webFrameLoaderClient ? webFrameLoaderClient->webFrame() : 0; 575 ASSERT(webFrame); 576 563 577 m_page->sendSync(Messages::WebPageProxy::PrintFrame(webFrame->frameID()), Messages::WebPageProxy::PrintFrame::Reply()); 564 578 } … … 567 581 void WebChromeClient::exceededDatabaseQuota(Frame* frame, const String& databaseName, DatabaseDetails details) 568 582 { 569 WebFrame* webFrame = static_cast<WebFrameLoaderClient*>(frame->loader()->client())->webFrame(); 583 WebFrameLoaderClient* webFrameLoaderClient = toWebFrameLoaderClient(frame->loader()->client()); 584 WebFrame* webFrame = webFrameLoaderClient ? webFrameLoaderClient->webFrame() : 0; 585 ASSERT(webFrame); 586 570 587 SecurityOrigin* origin = frame->document()->securityOrigin(); 571 588 … … 660 677 661 678 m_page->setActiveOpenPanelResultListener(WebOpenPanelResultListener::create(m_page, fileChooser.get())); 662 m_page->send(Messages::WebPageProxy::RunOpenPanel(static_cast<WebFrameLoaderClient*>(frame->loader()->client())->webFrame()->frameID(), fileChooser->settings())); 679 680 WebFrameLoaderClient* webFrameLoaderClient = toWebFrameLoaderClient(frame->loader()->client()); 681 WebFrame* webFrame = webFrameLoaderClient ? webFrameLoaderClient->webFrame() : 0; 682 ASSERT(webFrame); 683 684 m_page->send(Messages::WebPageProxy::RunOpenPanel(webFrame->frameID(), fileChooser->settings())); 663 685 } 664 686 -
trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp
r150140 r150282 321 321 return; 322 322 323 WebFrame* webFrame = static_cast<WebFrameLoaderClient*>(element->document()->frame()->loader()->client())->webFrame(); 323 WebFrameLoaderClient* webFrameLoaderClient = toWebFrameLoaderClient(element->document()->frame()->loader()->client()); 324 WebFrame* webFrame = webFrameLoaderClient ? webFrameLoaderClient->webFrame() : 0; 325 ASSERT(webFrame); 326 324 327 m_page->injectedBundleFormClient().textFieldDidBeginEditing(m_page, static_cast<HTMLInputElement*>(element), webFrame); 325 328 } … … 330 333 return; 331 334 332 WebFrame* webFrame = static_cast<WebFrameLoaderClient*>(element->document()->frame()->loader()->client())->webFrame(); 335 WebFrameLoaderClient* webFrameLoaderClient = toWebFrameLoaderClient(element->document()->frame()->loader()->client()); 336 WebFrame* webFrame = webFrameLoaderClient ? webFrameLoaderClient->webFrame() : 0; 337 ASSERT(webFrame); 338 333 339 m_page->injectedBundleFormClient().textFieldDidEndEditing(m_page, static_cast<HTMLInputElement*>(element), webFrame); 334 340 } … … 342 348 return; 343 349 344 WebFrame* webFrame = static_cast<WebFrameLoaderClient*>(element->document()->frame()->loader()->client())->webFrame(); 350 WebFrameLoaderClient* webFrameLoaderClient = toWebFrameLoaderClient(element->document()->frame()->loader()->client()); 351 WebFrame* webFrame = webFrameLoaderClient ? webFrameLoaderClient->webFrame() : 0; 352 ASSERT(webFrame); 353 345 354 m_page->injectedBundleFormClient().textDidChangeInTextField(m_page, static_cast<HTMLInputElement*>(element), webFrame); 346 355 } … … 351 360 return; 352 361 353 WebFrame* webFrame = static_cast<WebFrameLoaderClient*>(element->document()->frame()->loader()->client())->webFrame(); 362 WebFrameLoaderClient* webFrameLoaderClient = toWebFrameLoaderClient(element->document()->frame()->loader()->client()); 363 WebFrame* webFrame = webFrameLoaderClient ? webFrameLoaderClient->webFrame() : 0; 364 ASSERT(webFrame); 365 354 366 m_page->injectedBundleFormClient().textDidChangeInTextArea(m_page, static_cast<HTMLTextAreaElement*>(element), webFrame); 355 367 } … … 386 398 return false; 387 399 388 WebFrame* webFrame = static_cast<WebFrameLoaderClient*>(element->document()->frame()->loader()->client())->webFrame(); 400 WebFrameLoaderClient* webFrameLoaderClient = toWebFrameLoaderClient(element->document()->frame()->loader()->client()); 401 WebFrame* webFrame = webFrameLoaderClient ? webFrameLoaderClient->webFrame() : 0; 402 ASSERT(webFrame); 403 389 404 return m_page->injectedBundleFormClient().shouldPerformActionInTextField(m_page, static_cast<HTMLInputElement*>(element), actionType, webFrame); 390 405 } … … 395 410 return; 396 411 397 WebFrame* webFrame = static_cast<WebFrameLoaderClient*>(element->document()->frame()->loader()->client())->webFrame(); 412 WebFrameLoaderClient* webFrameLoaderClient = toWebFrameLoaderClient(element->document()->frame()->loader()->client()); 413 WebFrame* webFrame = webFrameLoaderClient ? webFrameLoaderClient->webFrame() : 0; 414 ASSERT(webFrame); 415 398 416 m_page->injectedBundleFormClient().shouldPerformActionInTextField(m_page, static_cast<HTMLInputElement*>(element), WKInputFieldActionTypeInsertDelete, webFrame); 399 417 } -
trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
r150227 r150282 736 736 RefPtr<FormState> formState = prpFormState; 737 737 HTMLFormElement* form = formState->form(); 738 WebFrame* sourceFrame = static_cast<WebFrameLoaderClient*>(formState->sourceDocument()->frame()->loader()->client())->webFrame(); 738 739 WebFrameLoaderClient* webFrameLoaderClient = toWebFrameLoaderClient(formState->sourceDocument()->frame()->loader()->client()); 740 WebFrame* sourceFrame = webFrameLoaderClient ? webFrameLoaderClient->webFrame() : 0; 741 ASSERT(sourceFrame); 739 742 740 743 webPage->injectedBundleFormClient().willSendSubmitEvent(webPage, form, m_frame, sourceFrame, formState->textFieldValues()); … … 751 754 752 755 HTMLFormElement* form = formState->form(); 753 WebFrame* sourceFrame = static_cast<WebFrameLoaderClient*>(formState->sourceDocument()->frame()->loader()->client())->webFrame(); 756 757 WebFrameLoaderClient* webFrameLoaderClient = toWebFrameLoaderClient(formState->sourceDocument()->frame()->loader()->client()); 758 WebFrame* sourceFrame = webFrameLoaderClient ? webFrameLoaderClient->webFrame() : 0; 759 ASSERT(sourceFrame); 760 754 761 const Vector<std::pair<String, String>>& values = formState->textFieldValues(); 755 762 -
trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h
r149830 r150282 233 233 }; 234 234 235 // As long as EmptyFrameLoaderClient exists in WebCore, this can return 0. 236 inline WebFrameLoaderClient* toWebFrameLoaderClient(WebCore::FrameLoaderClient* client) 237 { 238 return client->isEmptyFrameLoaderClient() ? 0 : static_cast<WebFrameLoaderClient*>(client); 239 } 240 235 241 } // namespace WebKit 236 242 -
trunk/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp
r150140 r150282 296 296 if (!builder.isEmpty()) 297 297 builder.append(' '); 298 builder.append(static_cast<WebFrameLoaderClient*>(child->loader()->client())->webFrame()->contentsAsString()); 298 299 WebFrameLoaderClient* webFrameLoaderClient = toWebFrameLoaderClient(child->loader()->client()); 300 WebFrame* webFrame = webFrameLoaderClient ? webFrameLoaderClient->webFrame() : 0; 301 ASSERT(webFrame); 302 303 builder.append(webFrame->contentsAsString()); 299 304 } 300 305 // FIXME: It may make sense to use toStringPreserveCapacity() here. … … 395 400 return 0; 396 401 397 return static_cast<WebFrameLoaderClient*>(m_coreFrame->ownerElement()->document()->frame()->loader()->client())->webFrame(); 402 WebFrameLoaderClient* webFrameLoaderClient = toWebFrameLoaderClient(m_coreFrame->ownerElement()->document()->frame()->loader()->client()); 403 return webFrameLoaderClient ? webFrameLoaderClient->webFrame() : 0; 398 404 } 399 405 … … 411 417 412 418 for (Frame* child = m_coreFrame->tree()->firstChild(); child; child = child->tree()->nextSibling()) { 413 WebFrame* webFrame = static_cast<WebFrameLoaderClient*>(child->loader()->client())->webFrame(); 419 WebFrameLoaderClient* webFrameLoaderClient = toWebFrameLoaderClient(child->loader()->client()); 420 WebFrame* webFrame = webFrameLoaderClient ? webFrameLoaderClient->webFrame() : 0; 421 ASSERT(webFrame); 414 422 vector.uncheckedAppend(webFrame); 415 423 } … … 614 622 615 623 Frame* coreFrame = static_cast<JSDOMWindowShell*>(globalObjectObj)->window()->impl()->frame(); 616 return static_cast<WebFrameLoaderClient*>(coreFrame->loader()->client())->webFrame(); 624 625 WebFrameLoaderClient* webFrameLoaderClient = toWebFrameLoaderClient(coreFrame->loader()->client()); 626 return webFrameLoaderClient ? webFrameLoaderClient->webFrame() : 0; 617 627 } 618 628 … … 737 747 if (!m_callback) 738 748 return true; 739 740 WebFrame* webFrame = static_cast<WebFrameLoaderClient*>(frame->loader()->client())->webFrame(); 749 750 WebFrameLoaderClient* webFrameLoaderClient = toWebFrameLoaderClient(frame->loader()->client()); 751 WebFrame* webFrame = webFrameLoaderClient ? webFrameLoaderClient->webFrame() : 0; 752 ASSERT(webFrame); 753 741 754 return m_callback(toAPI(m_topLevelWebFrame), toAPI(webFrame), m_context); 742 755 } -
trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
r150271 r150282 2976 2976 bool WebPage::mainFrameHasCustomRepresentation() const 2977 2977 { 2978 if (Frame* frame = mainFrame()) 2979 return static_cast<WebFrameLoaderClient*>(frame->loader()->client())->frameHasCustomRepresentation(); 2978 if (Frame* frame = mainFrame()) { 2979 WebFrameLoaderClient* webFrameLoaderClient = toWebFrameLoaderClient(frame->loader()->client()); 2980 ASSERT(webFrameLoaderClient); 2981 return webFrameLoaderClient->frameHasCustomRepresentation(); 2982 } 2980 2983 2981 2984 return false;
Note:
See TracChangeset
for help on using the changeset viewer.