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 4403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4414 ASSERT(newCurrentScript); | 4414 ASSERT(newCurrentScript); |
4415 m_currentScriptStack.append(newCurrentScript); | 4415 m_currentScriptStack.append(newCurrentScript); |
4416 } | 4416 } |
4417 | 4417 |
4418 void Document::popCurrentScript() | 4418 void Document::popCurrentScript() |
4419 { | 4419 { |
4420 ASSERT(!m_currentScriptStack.isEmpty()); | 4420 ASSERT(!m_currentScriptStack.isEmpty()); |
4421 m_currentScriptStack.removeLast(); | 4421 m_currentScriptStack.removeLast(); |
4422 } | 4422 } |
4423 | 4423 |
4424 void Document::applyXSLTransform(ProcessingInstruction* pi) | |
4425 { | |
4426 ASSERT(!pi->isLoading()); | |
4427 UseCounter::count(*this, UseCounter::XSLProcessingInstruction); | |
4428 RefPtrWillBeRawPtr<XSLTProcessor> processor = XSLTProcessor::create(*this); | |
4429 processor->setXSLStyleSheet(toXSLStyleSheet(pi->sheet())); | |
4430 String resultMIMEType; | |
4431 String newSource; | |
4432 String resultEncoding; | |
4433 setParsingState(Parsing); | |
4434 if (!processor->transformToString(this, resultMIMEType, newSource, resultEnc
oding)) { | |
4435 setParsingState(FinishedParsing); | |
4436 return; | |
4437 } | |
4438 // FIXME: If the transform failed we should probably report an error (like M
ozilla does). | |
4439 LocalFrame* ownerFrame = frame(); | |
4440 processor->createDocumentFromSource(newSource, resultEncoding, resultMIMETyp
e, this, ownerFrame); | |
4441 InspectorInstrumentation::frameDocumentUpdated(ownerFrame); | |
4442 setParsingState(FinishedParsing); | |
4443 } | |
4444 | |
4445 void Document::setTransformSource(PassOwnPtr<TransformSource> source) | 4424 void Document::setTransformSource(PassOwnPtr<TransformSource> source) |
4446 { | 4425 { |
4447 m_transformSource = source; | 4426 m_transformSource = source; |
4448 } | 4427 } |
4449 | 4428 |
4450 void Document::setDesignMode(InheritedBool value) | 4429 void Document::setDesignMode(InheritedBool value) |
4451 { | 4430 { |
4452 m_designMode = value; | 4431 m_designMode = value; |
4453 for (Frame* frame = m_frame; frame; frame = frame->tree().traverseNext(m_fra
me)) { | 4432 for (Frame* frame = m_frame; frame; frame = frame->tree().traverseNext(m_fra
me)) { |
4454 if (!frame->isLocalFrame()) | 4433 if (!frame->isLocalFrame()) |
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4849 // We alias the SecurityOrigins to match Firefox, see Bug 15313 | 4828 // We alias the SecurityOrigins to match Firefox, see Bug 15313 |
4850 // https://bugs.webkit.org/show_bug.cgi?id=15313 | 4829 // https://bugs.webkit.org/show_bug.cgi?id=15313 |
4851 setSecurityOrigin(initializer.owner()->securityOrigin()); | 4830 setSecurityOrigin(initializer.owner()->securityOrigin()); |
4852 } | 4831 } |
4853 | 4832 |
4854 void Document::initContentSecurityPolicy(PassRefPtr<ContentSecurityPolicy> csp) | 4833 void Document::initContentSecurityPolicy(PassRefPtr<ContentSecurityPolicy> csp) |
4855 { | 4834 { |
4856 setContentSecurityPolicy(csp ? csp : ContentSecurityPolicy::create()); | 4835 setContentSecurityPolicy(csp ? csp : ContentSecurityPolicy::create()); |
4857 if (m_frame && m_frame->tree().parent() && m_frame->tree().parent()->isLocal
Frame() && (shouldInheritSecurityOriginFromOwner(m_url) || isPluginDocument())) | 4836 if (m_frame && m_frame->tree().parent() && m_frame->tree().parent()->isLocal
Frame() && (shouldInheritSecurityOriginFromOwner(m_url) || isPluginDocument())) |
4858 contentSecurityPolicy()->copyStateFrom(toLocalFrame(m_frame->tree().pare
nt())->document()->contentSecurityPolicy()); | 4837 contentSecurityPolicy()->copyStateFrom(toLocalFrame(m_frame->tree().pare
nt())->document()->contentSecurityPolicy()); |
4859 if (transformSourceDocument()) | |
4860 contentSecurityPolicy()->copyStateFrom(transformSourceDocument()->conten
tSecurityPolicy()); | |
4861 contentSecurityPolicy()->bindToExecutionContext(this); | 4838 contentSecurityPolicy()->bindToExecutionContext(this); |
4862 } | 4839 } |
4863 | 4840 |
4864 bool Document::allowInlineEventHandlers(Node* node, EventListener* listener, con
st String& contextURL, const WTF::OrdinalNumber& contextLine) | 4841 bool Document::allowInlineEventHandlers(Node* node, EventListener* listener, con
st String& contextURL, const WTF::OrdinalNumber& contextLine) |
4865 { | 4842 { |
4866 if (!contentSecurityPolicy()->allowInlineEventHandlers(contextURL, contextLi
ne)) | 4843 if (!contentSecurityPolicy()->allowInlineEventHandlers(contextURL, contextLi
ne)) |
4867 return false; | 4844 return false; |
4868 | 4845 |
4869 // HTML says that inline script needs browsing context to create its executi
on environment. | 4846 // HTML says that inline script needs browsing context to create its executi
on environment. |
4870 // http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.ht
ml#event-handler-attributes | 4847 // http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.ht
ml#event-handler-attributes |
(...skipping 978 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5849 #ifndef NDEBUG | 5826 #ifndef NDEBUG |
5850 using namespace blink; | 5827 using namespace blink; |
5851 void showLiveDocumentInstances() | 5828 void showLiveDocumentInstances() |
5852 { | 5829 { |
5853 WeakDocumentSet& set = liveDocumentSet(); | 5830 WeakDocumentSet& set = liveDocumentSet(); |
5854 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 5831 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
5855 for (Document* document : set) | 5832 for (Document* document : set) |
5856 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()); |
5857 } | 5834 } |
5858 #endif | 5835 #endif |
OLD | NEW |