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 778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
789 ASSERT_UNUSED(writer, m_writer == writer); | 789 ASSERT_UNUSED(writer, m_writer == writer); |
790 m_writer->end(); | 790 m_writer->end(); |
791 m_writer.clear(); | 791 m_writer.clear(); |
792 } | 792 } |
793 | 793 |
794 PassRefPtr<DocumentWriter> DocumentLoader::createWriterFor(Frame* frame, const D
ocument* ownerDocument, const KURL& url, const AtomicString& mimeType, const Ato
micString& encoding, bool userChosen, bool dispatch) | 794 PassRefPtr<DocumentWriter> DocumentLoader::createWriterFor(Frame* frame, const D
ocument* ownerDocument, const KURL& url, const AtomicString& mimeType, const Ato
micString& encoding, bool userChosen, bool dispatch) |
795 { | 795 { |
796 // Create a new document before clearing the frame, because it may need to | 796 // Create a new document before clearing the frame, because it may need to |
797 // inherit an aliased security context. | 797 // inherit an aliased security context. |
798 DocumentInit init(url, frame); | 798 DocumentInit init(url, frame); |
| 799 init.withNewRegistrationContext(); |
799 | 800 |
800 // In some rare cases, we'll re-used a DOMWindow for a new Document. For exa
mple, | 801 // In some rare cases, we'll re-used a DOMWindow for a new Document. For exa
mple, |
801 // when a script calls window.open("..."), the browser gives JavaScript a wi
ndow | 802 // when a script calls window.open("..."), the browser gives JavaScript a wi
ndow |
802 // synchronously but kicks off the load in the window asynchronously. Web si
tes | 803 // synchronously but kicks off the load in the window asynchronously. Web si
tes |
803 // expect that modifications that they make to the window object synchronous
ly | 804 // expect that modifications that they make to the window object synchronous
ly |
804 // won't be blown away when the network load commits. To make that happen, w
e | 805 // won't be blown away when the network load commits. To make that happen, w
e |
805 // "securely transition" the existing DOMWindow to the Document that results
from | 806 // "securely transition" the existing DOMWindow to the Document that results
from |
806 // the network load. See also SecurityContext::isSecureTransitionTo. | 807 // the network load. See also SecurityContext::isSecureTransitionTo. |
807 bool shouldReuseDefaultView = frame->loader().stateMachine()->isDisplayingIn
itialEmptyDocument() && frame->document()->isSecureTransitionTo(url); | 808 bool shouldReuseDefaultView = frame->loader().stateMachine()->isDisplayingIn
itialEmptyDocument() && frame->document()->isSecureTransitionTo(url); |
808 | 809 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
844 void DocumentLoader::replaceDocument(const String& source, Document* ownerDocume
nt) | 845 void DocumentLoader::replaceDocument(const String& source, Document* ownerDocume
nt) |
845 { | 846 { |
846 m_frame->loader().stopAllLoaders(); | 847 m_frame->loader().stopAllLoaders(); |
847 m_writer = createWriterFor(m_frame, ownerDocument, m_frame->document()->url(
), mimeType(), m_writer ? m_writer->encoding() : emptyAtom, m_writer ? m_writer
->encodingWasChosenByUser() : false, true); | 848 m_writer = createWriterFor(m_frame, ownerDocument, m_frame->document()->url(
), mimeType(), m_writer ? m_writer->encoding() : emptyAtom, m_writer ? m_writer
->encodingWasChosenByUser() : false, true); |
848 if (!source.isNull()) | 849 if (!source.isNull()) |
849 m_writer->appendReplacingData(source); | 850 m_writer->appendReplacingData(source); |
850 endWriting(m_writer.get()); | 851 endWriting(m_writer.get()); |
851 } | 852 } |
852 | 853 |
853 } // namespace WebCore | 854 } // namespace WebCore |
OLD | NEW |