| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2011 Google Inc. All rights reserved. | 3 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 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 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 return m_request; | 152 return m_request; |
| 153 } | 153 } |
| 154 | 154 |
| 155 const KURL& DocumentLoader::url() const | 155 const KURL& DocumentLoader::url() const |
| 156 { | 156 { |
| 157 return m_request.url(); | 157 return m_request.url(); |
| 158 } | 158 } |
| 159 | 159 |
| 160 Resource* DocumentLoader::startPreload(Resource::Type type, FetchRequest& reques
t) | 160 Resource* DocumentLoader::startPreload(Resource::Type type, FetchRequest& reques
t) |
| 161 { | 161 { |
| 162 RefPtrWillBeRawPtr<Resource> resource = nullptr; | 162 RawPtr<Resource> resource = nullptr; |
| 163 switch (type) { | 163 switch (type) { |
| 164 case Resource::Image: | 164 case Resource::Image: |
| 165 resource = ImageResource::fetch(request, fetcher()); | 165 resource = ImageResource::fetch(request, fetcher()); |
| 166 break; | 166 break; |
| 167 case Resource::Script: | 167 case Resource::Script: |
| 168 resource = ScriptResource::fetch(request, fetcher()); | 168 resource = ScriptResource::fetch(request, fetcher()); |
| 169 break; | 169 break; |
| 170 case Resource::CSSStyleSheet: | 170 case Resource::CSSStyleSheet: |
| 171 resource = CSSStyleSheetResource::fetch(request, fetcher()); | 171 resource = CSSStyleSheetResource::fetch(request, fetcher()); |
| 172 break; | 172 break; |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 frameLoader()->receivedMainResourceError(this, error); | 235 frameLoader()->receivedMainResourceError(this, error); |
| 236 clearMainResourceHandle(); | 236 clearMainResourceHandle(); |
| 237 } | 237 } |
| 238 | 238 |
| 239 // Cancels the data source's pending loads. Conceptually, a data source only lo
ads | 239 // Cancels the data source's pending loads. Conceptually, a data source only lo
ads |
| 240 // one document at a time, but one document may have many related resources. | 240 // one document at a time, but one document may have many related resources. |
| 241 // stopLoading will stop all loads initiated by the data source, | 241 // stopLoading will stop all loads initiated by the data source, |
| 242 // but not loads initiated by child frames' data sources -- that's the WebFrame'
s job. | 242 // but not loads initiated by child frames' data sources -- that's the WebFrame'
s job. |
| 243 void DocumentLoader::stopLoading() | 243 void DocumentLoader::stopLoading() |
| 244 { | 244 { |
| 245 RefPtrWillBeRawPtr<LocalFrame> protectFrame(m_frame.get()); | 245 RawPtr<LocalFrame> protectFrame(m_frame.get()); |
| 246 RefPtrWillBeRawPtr<DocumentLoader> protectLoader(this); | 246 RawPtr<DocumentLoader> protectLoader(this); |
| 247 | 247 |
| 248 if (isLoading()) | 248 if (isLoading()) |
| 249 cancelMainResourceLoad(ResourceError::cancelledError(m_request.url())); | 249 cancelMainResourceLoad(ResourceError::cancelledError(m_request.url())); |
| 250 m_fetcher->stopFetching(); | 250 m_fetcher->stopFetching(); |
| 251 } | 251 } |
| 252 | 252 |
| 253 void DocumentLoader::commitIfReady() | 253 void DocumentLoader::commitIfReady() |
| 254 { | 254 { |
| 255 if (m_state < Committed) { | 255 if (m_state < Committed) { |
| 256 m_state = Committed; | 256 m_state = Committed; |
| 257 frameLoader()->commitProvisionalLoad(); | 257 frameLoader()->commitProvisionalLoad(); |
| 258 } | 258 } |
| 259 } | 259 } |
| 260 | 260 |
| 261 bool DocumentLoader::isLoading() const | 261 bool DocumentLoader::isLoading() const |
| 262 { | 262 { |
| 263 if (document() && document()->hasActiveParser()) | 263 if (document() && document()->hasActiveParser()) |
| 264 return true; | 264 return true; |
| 265 | 265 |
| 266 return (m_state > NotStarted && m_state < MainResourceDone) || m_fetcher->is
Fetching(); | 266 return (m_state > NotStarted && m_state < MainResourceDone) || m_fetcher->is
Fetching(); |
| 267 } | 267 } |
| 268 | 268 |
| 269 void DocumentLoader::notifyFinished(Resource* resource) | 269 void DocumentLoader::notifyFinished(Resource* resource) |
| 270 { | 270 { |
| 271 ASSERT_UNUSED(resource, m_mainResource == resource); | 271 ASSERT_UNUSED(resource, m_mainResource == resource); |
| 272 ASSERT(m_mainResource); | 272 ASSERT(m_mainResource); |
| 273 | 273 |
| 274 RefPtrWillBeRawPtr<DocumentLoader> protect(this); | 274 RawPtr<DocumentLoader> protect(this); |
| 275 | 275 |
| 276 if (!m_mainResource->errorOccurred() && !m_mainResource->wasCanceled()) { | 276 if (!m_mainResource->errorOccurred() && !m_mainResource->wasCanceled()) { |
| 277 finishedLoading(m_mainResource->loadFinishTime()); | 277 finishedLoading(m_mainResource->loadFinishTime()); |
| 278 return; | 278 return; |
| 279 } | 279 } |
| 280 | 280 |
| 281 mainReceivedError(m_mainResource->resourceError()); | 281 mainReceivedError(m_mainResource->resourceError()); |
| 282 } | 282 } |
| 283 | 283 |
| 284 void DocumentLoader::finishedLoading(double finishTime) | 284 void DocumentLoader::finishedLoading(double finishTime) |
| 285 { | 285 { |
| 286 ASSERT(!mainResourceLoader() || !mainResourceLoader()->defersLoading() || In
spectorInstrumentation::isDebuggerPaused(m_frame)); | 286 ASSERT(!mainResourceLoader() || !mainResourceLoader()->defersLoading() || In
spectorInstrumentation::isDebuggerPaused(m_frame)); |
| 287 | 287 |
| 288 RefPtrWillBeRawPtr<DocumentLoader> protect(this); | 288 RawPtr<DocumentLoader> protect(this); |
| 289 | 289 |
| 290 double responseEndTime = finishTime; | 290 double responseEndTime = finishTime; |
| 291 if (!responseEndTime) | 291 if (!responseEndTime) |
| 292 responseEndTime = m_timeOfLastDataReceived; | 292 responseEndTime = m_timeOfLastDataReceived; |
| 293 if (!responseEndTime) | 293 if (!responseEndTime) |
| 294 responseEndTime = monotonicallyIncreasingTime(); | 294 responseEndTime = monotonicallyIncreasingTime(); |
| 295 timing().setResponseEnd(responseEndTime); | 295 timing().setResponseEnd(responseEndTime); |
| 296 | 296 |
| 297 commitIfReady(); | 297 commitIfReady(); |
| 298 if (!frameLoader()) | 298 if (!frameLoader()) |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 // The load event might have detached this frame. In that case, the load wil
l already have been cancelled during detach. | 386 // The load event might have detached this frame. In that case, the load wil
l already have been cancelled during detach. |
| 387 if (frameLoader()) | 387 if (frameLoader()) |
| 388 cancelMainResourceLoad(ResourceError::cancelledError(m_request.url())); | 388 cancelMainResourceLoad(ResourceError::cancelledError(m_request.url())); |
| 389 return; | 389 return; |
| 390 } | 390 } |
| 391 | 391 |
| 392 void DocumentLoader::responseReceived(Resource* resource, const ResourceResponse
& response, PassOwnPtr<WebDataConsumerHandle> handle) | 392 void DocumentLoader::responseReceived(Resource* resource, const ResourceResponse
& response, PassOwnPtr<WebDataConsumerHandle> handle) |
| 393 { | 393 { |
| 394 ASSERT_UNUSED(resource, m_mainResource == resource); | 394 ASSERT_UNUSED(resource, m_mainResource == resource); |
| 395 ASSERT_UNUSED(handle, !handle); | 395 ASSERT_UNUSED(handle, !handle); |
| 396 RefPtrWillBeRawPtr<DocumentLoader> protect(this); | 396 RawPtr<DocumentLoader> protect(this); |
| 397 ASSERT(frame()); | 397 ASSERT(frame()); |
| 398 | 398 |
| 399 m_applicationCacheHost->didReceiveResponseForMainResource(response); | 399 m_applicationCacheHost->didReceiveResponseForMainResource(response); |
| 400 | 400 |
| 401 // The memory cache doesn't understand the application cache or its caching
rules. So if a main resource is served | 401 // The memory cache doesn't understand the application cache or its caching
rules. So if a main resource is served |
| 402 // from the application cache, ensure we don't save the result for future us
e. All responses loaded | 402 // from the application cache, ensure we don't save the result for future us
e. All responses loaded |
| 403 // from appcache will have a non-zero appCacheID(). | 403 // from appcache will have a non-zero appCacheID(). |
| 404 if (response.appCacheID()) | 404 if (response.appCacheID()) |
| 405 memoryCache()->remove(m_mainResource.get()); | 405 memoryCache()->remove(m_mainResource.get()); |
| 406 | 406 |
| 407 m_contentSecurityPolicy = ContentSecurityPolicy::create(); | 407 m_contentSecurityPolicy = ContentSecurityPolicy::create(); |
| 408 m_contentSecurityPolicy->setOverrideURLForSelf(response.url()); | 408 m_contentSecurityPolicy->setOverrideURLForSelf(response.url()); |
| 409 m_contentSecurityPolicy->didReceiveHeaders(ContentSecurityPolicyResponseHead
ers(response)); | 409 m_contentSecurityPolicy->didReceiveHeaders(ContentSecurityPolicyResponseHead
ers(response)); |
| 410 if (!m_contentSecurityPolicy->allowAncestors(m_frame, response.url())) { | 410 if (!m_contentSecurityPolicy->allowAncestors(m_frame, response.url())) { |
| 411 cancelLoadAfterXFrameOptionsOrCSPDenied(response); | 411 cancelLoadAfterXFrameOptionsOrCSPDenied(response); |
| 412 return; | 412 return; |
| 413 } | 413 } |
| 414 | 414 |
| 415 // 'frame-ancestors' obviates 'x-frame-options': https://w3c.github.io/webap
psec/specs/content-security-policy/#frame-ancestors-and-frame-options | 415 // 'frame-ancestors' obviates 'x-frame-options': https://w3c.github.io/webap
psec/specs/content-security-policy/#frame-ancestors-and-frame-options |
| 416 if (!m_contentSecurityPolicy->isFrameAncestorsEnforced()) { | 416 if (!m_contentSecurityPolicy->isFrameAncestorsEnforced()) { |
| 417 HTTPHeaderMap::const_iterator it = response.httpHeaderFields().find(HTTP
Names::X_Frame_Options); | 417 HTTPHeaderMap::const_iterator it = response.httpHeaderFields().find(HTTP
Names::X_Frame_Options); |
| 418 if (it != response.httpHeaderFields().end()) { | 418 if (it != response.httpHeaderFields().end()) { |
| 419 String content = it->value; | 419 String content = it->value; |
| 420 if (frameLoader()->shouldInterruptLoadForXFrameOptions(content, resp
onse.url(), mainResourceIdentifier())) { | 420 if (frameLoader()->shouldInterruptLoadForXFrameOptions(content, resp
onse.url(), mainResourceIdentifier())) { |
| 421 String message = "Refused to display '" + response.url().elidedS
tring() + "' in a frame because it set 'X-Frame-Options' to '" + content + "'."; | 421 String message = "Refused to display '" + response.url().elidedS
tring() + "' in a frame because it set 'X-Frame-Options' to '" + content + "'."; |
| 422 RefPtrWillBeRawPtr<ConsoleMessage> consoleMessage = ConsoleMessa
ge::create(SecurityMessageSource, ErrorMessageLevel, message); | 422 RawPtr<ConsoleMessage> consoleMessage = ConsoleMessage::create(S
ecurityMessageSource, ErrorMessageLevel, message); |
| 423 consoleMessage->setRequestIdentifier(mainResourceIdentifier()); | 423 consoleMessage->setRequestIdentifier(mainResourceIdentifier()); |
| 424 frame()->document()->addConsoleMessage(consoleMessage.release())
; | 424 frame()->document()->addConsoleMessage(consoleMessage.release())
; |
| 425 | 425 |
| 426 cancelLoadAfterXFrameOptionsOrCSPDenied(response); | 426 cancelLoadAfterXFrameOptionsOrCSPDenied(response); |
| 427 return; | 427 return; |
| 428 } | 428 } |
| 429 } | 429 } |
| 430 } | 430 } |
| 431 | 431 |
| 432 ASSERT(!mainResourceLoader() || !mainResourceLoader()->defersLoading()); | 432 ASSERT(!mainResourceLoader() || !mainResourceLoader()->defersLoading()); |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 512 // loop: | 512 // loop: |
| 513 // - alert(), confirm(), prompt() | 513 // - alert(), confirm(), prompt() |
| 514 // - Detach of plugin elements. | 514 // - Detach of plugin elements. |
| 515 // - Synchronous XMLHTTPRequest | 515 // - Synchronous XMLHTTPRequest |
| 516 m_dataBuffer->append(data, length); | 516 m_dataBuffer->append(data, length); |
| 517 return; | 517 return; |
| 518 } | 518 } |
| 519 | 519 |
| 520 // Both unloading the old page and parsing the new page may execute JavaScri
pt which destroys the datasource | 520 // Both unloading the old page and parsing the new page may execute JavaScri
pt which destroys the datasource |
| 521 // by starting a new load, so retain temporarily. | 521 // by starting a new load, so retain temporarily. |
| 522 RefPtrWillBeRawPtr<LocalFrame> protectFrame(m_frame.get()); | 522 RawPtr<LocalFrame> protectFrame(m_frame.get()); |
| 523 RefPtrWillBeRawPtr<DocumentLoader> protectLoader(this); | 523 RawPtr<DocumentLoader> protectLoader(this); |
| 524 | 524 |
| 525 TemporaryChange<bool> reentrancyProtector(m_inDataReceived, true); | 525 TemporaryChange<bool> reentrancyProtector(m_inDataReceived, true); |
| 526 processData(data, length); | 526 processData(data, length); |
| 527 | 527 |
| 528 // Process data received in reentrant invocations. Note that the | 528 // Process data received in reentrant invocations. Note that the |
| 529 // invocations of processData() may queue more data in reentrant | 529 // invocations of processData() may queue more data in reentrant |
| 530 // invocations, so iterate until it's empty. | 530 // invocations, so iterate until it's empty. |
| 531 const char* segment; | 531 const char* segment; |
| 532 size_t pos = 0; | 532 size_t pos = 0; |
| 533 while (size_t length = m_dataBuffer->getSomeData(segment, pos)) { | 533 while (size_t length = m_dataBuffer->getSomeData(segment, pos)) { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 567 } | 567 } |
| 568 | 568 |
| 569 bool DocumentLoader::loadingMultipartContent() const | 569 bool DocumentLoader::loadingMultipartContent() const |
| 570 { | 570 { |
| 571 return mainResourceLoader() ? mainResourceLoader()->loadingMultipartContent(
) : false; | 571 return mainResourceLoader() ? mainResourceLoader()->loadingMultipartContent(
) : false; |
| 572 } | 572 } |
| 573 | 573 |
| 574 void DocumentLoader::detachFromFrame() | 574 void DocumentLoader::detachFromFrame() |
| 575 { | 575 { |
| 576 ASSERT(m_frame); | 576 ASSERT(m_frame); |
| 577 RefPtrWillBeRawPtr<LocalFrame> protectFrame(m_frame.get()); | 577 RawPtr<LocalFrame> protectFrame(m_frame.get()); |
| 578 RefPtrWillBeRawPtr<DocumentLoader> protectLoader(this); | 578 RawPtr<DocumentLoader> protectLoader(this); |
| 579 | 579 |
| 580 // It never makes sense to have a document loader that is detached from its | 580 // It never makes sense to have a document loader that is detached from its |
| 581 // frame have any loads active, so go ahead and kill all the loads. | 581 // frame have any loads active, so go ahead and kill all the loads. |
| 582 stopLoading(); | 582 stopLoading(); |
| 583 | 583 |
| 584 // If that load cancellation triggered another detach, leave. | 584 // If that load cancellation triggered another detach, leave. |
| 585 // (fast/frames/detach-frame-nested-no-crash.html is an example of this.) | 585 // (fast/frames/detach-frame-nested-no-crash.html is an example of this.) |
| 586 if (!m_frame) | 586 if (!m_frame) |
| 587 return; | 587 return; |
| 588 | 588 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 653 | 653 |
| 654 if (m_request.url().isEmpty() && !frameLoader()->stateMachine()->creatingIni
tialEmptyDocument()) | 654 if (m_request.url().isEmpty() && !frameLoader()->stateMachine()->creatingIni
tialEmptyDocument()) |
| 655 m_request.setURL(blankURL()); | 655 m_request.setURL(blankURL()); |
| 656 m_response = ResourceResponse(m_request.url(), "text/html", 0, nullAtom, Str
ing()); | 656 m_response = ResourceResponse(m_request.url(), "text/html", 0, nullAtom, Str
ing()); |
| 657 finishedLoading(monotonicallyIncreasingTime()); | 657 finishedLoading(monotonicallyIncreasingTime()); |
| 658 return true; | 658 return true; |
| 659 } | 659 } |
| 660 | 660 |
| 661 void DocumentLoader::startLoadingMainResource() | 661 void DocumentLoader::startLoadingMainResource() |
| 662 { | 662 { |
| 663 RefPtrWillBeRawPtr<DocumentLoader> protect(this); | 663 RawPtr<DocumentLoader> protect(this); |
| 664 timing().markNavigationStart(); | 664 timing().markNavigationStart(); |
| 665 ASSERT(!m_mainResource); | 665 ASSERT(!m_mainResource); |
| 666 ASSERT(m_state == NotStarted); | 666 ASSERT(m_state == NotStarted); |
| 667 m_state = Provisional; | 667 m_state = Provisional; |
| 668 | 668 |
| 669 if (maybeLoadEmpty()) | 669 if (maybeLoadEmpty()) |
| 670 return; | 670 return; |
| 671 | 671 |
| 672 ASSERT(timing().navigationStart()); | 672 ASSERT(timing().navigationStart()); |
| 673 ASSERT(!timing().fetchStart()); | 673 ASSERT(!timing().fetchStart()); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 698 request = mainResourceLoader()->originalRequest(); | 698 request = mainResourceLoader()->originalRequest(); |
| 699 // If there was a fragment identifier on m_request, the cache will have stri
pped it. m_request should include | 699 // If there was a fragment identifier on m_request, the cache will have stri
pped it. m_request should include |
| 700 // the fragment identifier, so add that back in. | 700 // the fragment identifier, so add that back in. |
| 701 if (equalIgnoringFragmentIdentifier(m_request.url(), request.url())) | 701 if (equalIgnoringFragmentIdentifier(m_request.url(), request.url())) |
| 702 request.setURL(m_request.url()); | 702 request.setURL(m_request.url()); |
| 703 m_request = request; | 703 m_request = request; |
| 704 } | 704 } |
| 705 | 705 |
| 706 void DocumentLoader::cancelMainResourceLoad(const ResourceError& resourceError) | 706 void DocumentLoader::cancelMainResourceLoad(const ResourceError& resourceError) |
| 707 { | 707 { |
| 708 RefPtrWillBeRawPtr<DocumentLoader> protect(this); | 708 RawPtr<DocumentLoader> protect(this); |
| 709 ResourceError error = resourceError.isNull() ? ResourceError::cancelledError
(m_request.url()) : resourceError; | 709 ResourceError error = resourceError.isNull() ? ResourceError::cancelledError
(m_request.url()) : resourceError; |
| 710 | 710 |
| 711 if (mainResourceLoader()) | 711 if (mainResourceLoader()) |
| 712 mainResourceLoader()->cancel(error); | 712 mainResourceLoader()->cancel(error); |
| 713 | 713 |
| 714 mainReceivedError(error); | 714 mainReceivedError(error); |
| 715 } | 715 } |
| 716 | 716 |
| 717 void DocumentLoader::attachThreadedDataReceiver(PassRefPtrWillBeRawPtr<ThreadedD
ataReceiver> threadedDataReceiver) | 717 void DocumentLoader::attachThreadedDataReceiver(RawPtr<ThreadedDataReceiver> thr
eadedDataReceiver) |
| 718 { | 718 { |
| 719 if (mainResourceLoader()) | 719 if (mainResourceLoader()) |
| 720 mainResourceLoader()->attachThreadedDataReceiver(threadedDataReceiver); | 720 mainResourceLoader()->attachThreadedDataReceiver(threadedDataReceiver); |
| 721 } | 721 } |
| 722 | 722 |
| 723 void DocumentLoader::acceptDataFromThreadedReceiver(const char* data, int dataLe
ngth, int encodedDataLength) | 723 void DocumentLoader::acceptDataFromThreadedReceiver(const char* data, int dataLe
ngth, int encodedDataLength) |
| 724 { | 724 { |
| 725 m_fetcher->acceptDataFromThreadedReceiver(mainResourceIdentifier(), data, da
taLength, encodedDataLength); | 725 m_fetcher->acceptDataFromThreadedReceiver(mainResourceIdentifier(), data, da
taLength, encodedDataLength); |
| 726 } | 726 } |
| 727 | 727 |
| 728 void DocumentLoader::endWriting(DocumentWriter* writer) | 728 void DocumentLoader::endWriting(DocumentWriter* writer) |
| 729 { | 729 { |
| 730 ASSERT_UNUSED(writer, m_writer == writer); | 730 ASSERT_UNUSED(writer, m_writer == writer); |
| 731 m_writer->end(); | 731 m_writer->end(); |
| 732 m_writer.clear(); | 732 m_writer.clear(); |
| 733 } | 733 } |
| 734 | 734 |
| 735 PassRefPtrWillBeRawPtr<DocumentWriter> DocumentLoader::createWriterFor(const Doc
ument* ownerDocument, const DocumentInit& init, const AtomicString& mimeType, co
nst AtomicString& encoding, bool dispatch, ParserSynchronizationPolicy parsingPo
licy) | 735 RawPtr<DocumentWriter> DocumentLoader::createWriterFor(const Document* ownerDocu
ment, const DocumentInit& init, const AtomicString& mimeType, const AtomicString
& encoding, bool dispatch, ParserSynchronizationPolicy parsingPolicy) |
| 736 { | 736 { |
| 737 LocalFrame* frame = init.frame(); | 737 LocalFrame* frame = init.frame(); |
| 738 | 738 |
| 739 ASSERT(!frame->document() || !frame->document()->isActive()); | 739 ASSERT(!frame->document() || !frame->document()->isActive()); |
| 740 ASSERT(frame->tree().childCount() == 0); | 740 ASSERT(frame->tree().childCount() == 0); |
| 741 | 741 |
| 742 if (!init.shouldReuseDefaultView()) | 742 if (!init.shouldReuseDefaultView()) |
| 743 frame->setDOMWindow(LocalDOMWindow::create(*frame)); | 743 frame->setDOMWindow(LocalDOMWindow::create(*frame)); |
| 744 | 744 |
| 745 RefPtrWillBeRawPtr<Document> document = frame->localDOMWindow()->installNewD
ocument(mimeType, init); | 745 RawPtr<Document> document = frame->localDOMWindow()->installNewDocument(mime
Type, init); |
| 746 if (ownerDocument) { | 746 if (ownerDocument) { |
| 747 document->setCookieURL(ownerDocument->cookieURL()); | 747 document->setCookieURL(ownerDocument->cookieURL()); |
| 748 document->setSecurityOrigin(ownerDocument->securityOrigin()); | 748 document->setSecurityOrigin(ownerDocument->securityOrigin()); |
| 749 } | 749 } |
| 750 | 750 |
| 751 frame->loader().didBeginDocument(dispatch); | 751 frame->loader().didBeginDocument(dispatch); |
| 752 | 752 |
| 753 return DocumentWriter::create(document.get(), parsingPolicy, mimeType, encod
ing); | 753 return DocumentWriter::create(document.get(), parsingPolicy, mimeType, encod
ing); |
| 754 } | 754 } |
| 755 | 755 |
| 756 const AtomicString& DocumentLoader::mimeType() const | 756 const AtomicString& DocumentLoader::mimeType() const |
| 757 { | 757 { |
| 758 if (m_writer) | 758 if (m_writer) |
| 759 return m_writer->mimeType(); | 759 return m_writer->mimeType(); |
| 760 return m_response.mimeType(); | 760 return m_response.mimeType(); |
| 761 } | 761 } |
| 762 | 762 |
| 763 // This is only called by FrameLoader::replaceDocumentWhileExecutingJavaScriptUR
L() | 763 // This is only called by FrameLoader::replaceDocumentWhileExecutingJavaScriptUR
L() |
| 764 void DocumentLoader::replaceDocumentWhileExecutingJavaScriptURL(const DocumentIn
it& init, const String& source, Document* ownerDocument) | 764 void DocumentLoader::replaceDocumentWhileExecutingJavaScriptURL(const DocumentIn
it& init, const String& source, Document* ownerDocument) |
| 765 { | 765 { |
| 766 m_writer = createWriterFor(ownerDocument, init, mimeType(), m_writer ? m_wri
ter->encoding() : emptyAtom, true, ForceSynchronousParsing); | 766 m_writer = createWriterFor(ownerDocument, init, mimeType(), m_writer ? m_wri
ter->encoding() : emptyAtom, true, ForceSynchronousParsing); |
| 767 if (!source.isNull()) | 767 if (!source.isNull()) |
| 768 m_writer->appendReplacingData(source); | 768 m_writer->appendReplacingData(source); |
| 769 endWriting(m_writer.get()); | 769 endWriting(m_writer.get()); |
| 770 } | 770 } |
| 771 | 771 |
| 772 DEFINE_WEAK_IDENTIFIER_MAP(DocumentLoader); | 772 DEFINE_WEAK_IDENTIFIER_MAP(DocumentLoader); |
| 773 | 773 |
| 774 } // namespace blink | 774 } // namespace blink |
| OLD | NEW |