OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r
ights reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r
ights reserved. |
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) | 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) |
8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. | 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. |
9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) | 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) |
10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. | 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. |
(...skipping 4404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4415 ASSERT(newCurrentScript); | 4415 ASSERT(newCurrentScript); |
4416 m_currentScriptStack.append(newCurrentScript); | 4416 m_currentScriptStack.append(newCurrentScript); |
4417 } | 4417 } |
4418 | 4418 |
4419 void Document::popCurrentScript() | 4419 void Document::popCurrentScript() |
4420 { | 4420 { |
4421 ASSERT(!m_currentScriptStack.isEmpty()); | 4421 ASSERT(!m_currentScriptStack.isEmpty()); |
4422 m_currentScriptStack.removeLast(); | 4422 m_currentScriptStack.removeLast(); |
4423 } | 4423 } |
4424 | 4424 |
4425 void Document::applyXSLTransform(ProcessingInstruction* pi) | |
4426 { | |
4427 ASSERT(!pi->isLoading()); | |
4428 UseCounter::count(*this, UseCounter::XSLProcessingInstruction); | |
4429 RefPtrWillBeRawPtr<XSLTProcessor> processor = XSLTProcessor::create(*this); | |
4430 processor->setXSLStyleSheet(toXSLStyleSheet(pi->sheet())); | |
4431 String resultMIMEType; | |
4432 String newSource; | |
4433 String resultEncoding; | |
4434 setParsingState(Parsing); | |
4435 if (!processor->transformToString(this, resultMIMEType, newSource, resultEnc
oding)) { | |
4436 setParsingState(FinishedParsing); | |
4437 return; | |
4438 } | |
4439 // FIXME: If the transform failed we should probably report an error (like M
ozilla does). | |
4440 LocalFrame* ownerFrame = frame(); | |
4441 processor->createDocumentFromSource(newSource, resultEncoding, resultMIMETyp
e, this, ownerFrame); | |
4442 InspectorInstrumentation::frameDocumentUpdated(ownerFrame); | |
4443 setParsingState(FinishedParsing); | |
4444 } | |
4445 | |
4446 void Document::setTransformSource(PassOwnPtr<TransformSource> source) | 4425 void Document::setTransformSource(PassOwnPtr<TransformSource> source) |
4447 { | 4426 { |
4448 m_transformSource = source; | 4427 m_transformSource = source; |
4449 } | 4428 } |
4450 | 4429 |
4451 void Document::setDesignMode(InheritedBool value) | 4430 void Document::setDesignMode(InheritedBool value) |
4452 { | 4431 { |
4453 m_designMode = value; | 4432 m_designMode = value; |
4454 for (Frame* frame = m_frame; frame; frame = frame->tree().traverseNext(m_fra
me)) { | 4433 for (Frame* frame = m_frame; frame; frame = frame->tree().traverseNext(m_fra
me)) { |
4455 if (!frame->isLocalFrame()) | 4434 if (!frame->isLocalFrame()) |
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4850 // We alias the SecurityOrigins to match Firefox, see Bug 15313 | 4829 // We alias the SecurityOrigins to match Firefox, see Bug 15313 |
4851 // https://bugs.webkit.org/show_bug.cgi?id=15313 | 4830 // https://bugs.webkit.org/show_bug.cgi?id=15313 |
4852 setSecurityOrigin(initializer.owner()->securityOrigin()); | 4831 setSecurityOrigin(initializer.owner()->securityOrigin()); |
4853 } | 4832 } |
4854 | 4833 |
4855 void Document::initContentSecurityPolicy(PassRefPtr<ContentSecurityPolicy> csp) | 4834 void Document::initContentSecurityPolicy(PassRefPtr<ContentSecurityPolicy> csp) |
4856 { | 4835 { |
4857 setContentSecurityPolicy(csp ? csp : ContentSecurityPolicy::create()); | 4836 setContentSecurityPolicy(csp ? csp : ContentSecurityPolicy::create()); |
4858 if (m_frame && m_frame->tree().parent() && m_frame->tree().parent()->isLocal
Frame() && (shouldInheritSecurityOriginFromOwner(m_url) || isPluginDocument())) | 4837 if (m_frame && m_frame->tree().parent() && m_frame->tree().parent()->isLocal
Frame() && (shouldInheritSecurityOriginFromOwner(m_url) || isPluginDocument())) |
4859 contentSecurityPolicy()->copyStateFrom(toLocalFrame(m_frame->tree().pare
nt())->document()->contentSecurityPolicy()); | 4838 contentSecurityPolicy()->copyStateFrom(toLocalFrame(m_frame->tree().pare
nt())->document()->contentSecurityPolicy()); |
4860 if (transformSourceDocument()) | |
4861 contentSecurityPolicy()->copyStateFrom(transformSourceDocument()->conten
tSecurityPolicy()); | |
4862 contentSecurityPolicy()->bindToExecutionContext(this); | 4839 contentSecurityPolicy()->bindToExecutionContext(this); |
4863 } | 4840 } |
4864 | 4841 |
4865 bool Document::allowInlineEventHandlers(Node* node, EventListener* listener, con
st String& contextURL, const WTF::OrdinalNumber& contextLine) | 4842 bool Document::allowInlineEventHandlers(Node* node, EventListener* listener, con
st String& contextURL, const WTF::OrdinalNumber& contextLine) |
4866 { | 4843 { |
4867 if (!contentSecurityPolicy()->allowInlineEventHandlers(contextURL, contextLi
ne)) | 4844 if (!contentSecurityPolicy()->allowInlineEventHandlers(contextURL, contextLi
ne)) |
4868 return false; | 4845 return false; |
4869 | 4846 |
4870 // HTML says that inline script needs browsing context to create its executi
on environment. | 4847 // HTML says that inline script needs browsing context to create its executi
on environment. |
4871 // http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.ht
ml#event-handler-attributes | 4848 // http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.ht
ml#event-handler-attributes |
(...skipping 922 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5794 visitor->trace(m_autofocusElement); | 5771 visitor->trace(m_autofocusElement); |
5795 visitor->trace(m_focusedElement); | 5772 visitor->trace(m_focusedElement); |
5796 visitor->trace(m_hoverNode); | 5773 visitor->trace(m_hoverNode); |
5797 visitor->trace(m_activeHoverElement); | 5774 visitor->trace(m_activeHoverElement); |
5798 visitor->trace(m_documentElement); | 5775 visitor->trace(m_documentElement); |
5799 visitor->trace(m_titleElement); | 5776 visitor->trace(m_titleElement); |
5800 visitor->trace(m_markers); | 5777 visitor->trace(m_markers); |
5801 visitor->trace(m_cssTarget); | 5778 visitor->trace(m_cssTarget); |
5802 visitor->trace(m_currentScriptStack); | 5779 visitor->trace(m_currentScriptStack); |
5803 visitor->trace(m_scriptRunner); | 5780 visitor->trace(m_scriptRunner); |
5804 visitor->trace(m_transformSourceDocument); | |
5805 visitor->trace(m_listsInvalidatedAtDocument); | 5781 visitor->trace(m_listsInvalidatedAtDocument); |
5806 for (int i = 0; i < numNodeListInvalidationTypes; ++i) | 5782 for (int i = 0; i < numNodeListInvalidationTypes; ++i) |
5807 visitor->trace(m_nodeLists[i]); | 5783 visitor->trace(m_nodeLists[i]); |
5808 visitor->trace(m_cssCanvasElements); | 5784 visitor->trace(m_cssCanvasElements); |
5809 visitor->trace(m_topLayerElements); | 5785 visitor->trace(m_topLayerElements); |
5810 visitor->trace(m_elemSheet); | 5786 visitor->trace(m_elemSheet); |
5811 visitor->trace(m_nodeIterators); | 5787 visitor->trace(m_nodeIterators); |
5812 visitor->trace(m_ranges); | 5788 visitor->trace(m_ranges); |
5813 visitor->trace(m_styleEngine); | 5789 visitor->trace(m_styleEngine); |
5814 visitor->trace(m_formController); | 5790 visitor->trace(m_formController); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5850 #ifndef NDEBUG | 5826 #ifndef NDEBUG |
5851 using namespace blink; | 5827 using namespace blink; |
5852 void showLiveDocumentInstances() | 5828 void showLiveDocumentInstances() |
5853 { | 5829 { |
5854 WeakDocumentSet& set = liveDocumentSet(); | 5830 WeakDocumentSet& set = liveDocumentSet(); |
5855 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 5831 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
5856 for (Document* document : set) | 5832 for (Document* document : set) |
5857 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str
ing().utf8().data()); | 5833 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str
ing().utf8().data()); |
5858 } | 5834 } |
5859 #endif | 5835 #endif |
OLD | NEW |