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 | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All |
7 * rights reserved. | 7 * rights reserved. |
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. | 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. |
9 * (http://www.torchmobile.com/) | 9 * (http://www.torchmobile.com/) |
10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. | 10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. |
(...skipping 5113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5124 UseCounter::count(*this, osdDisposition); | 5124 UseCounter::count(*this, osdDisposition); |
5125 | 5125 |
5126 return linkElement->href(); | 5126 return linkElement->href(); |
5127 } | 5127 } |
5128 | 5128 |
5129 return KURL(); | 5129 return KURL(); |
5130 } | 5130 } |
5131 | 5131 |
5132 void Document::currentScriptForBinding( | 5132 void Document::currentScriptForBinding( |
5133 HTMLScriptElementOrSVGScriptElement& scriptElement) const { | 5133 HTMLScriptElementOrSVGScriptElement& scriptElement) const { |
5134 if (Element* script = currentScript()) { | 5134 if (!m_currentScriptStack.isEmpty()) |
5135 if (script->isInV1ShadowTree()) | 5135 m_currentScriptStack.back()->setScriptElementForBinding(scriptElement); |
5136 return; | |
5137 if (isHTMLScriptElement(script)) | |
5138 scriptElement.setHTMLScriptElement(toHTMLScriptElement(script)); | |
5139 else if (isSVGScriptElement(script)) | |
5140 scriptElement.setSVGScriptElement(toSVGScriptElement(script)); | |
5141 } | |
5142 } | 5136 } |
5143 | 5137 |
5144 void Document::pushCurrentScript(Element* newCurrentScript) { | 5138 void Document::pushCurrentScript(ScriptLoaderClient* newCurrentScript) { |
5145 DCHECK(isHTMLScriptElement(newCurrentScript) || | |
5146 isSVGScriptElement(newCurrentScript)); | |
5147 m_currentScriptStack.push_back(newCurrentScript); | 5139 m_currentScriptStack.push_back(newCurrentScript); |
5148 } | 5140 } |
5149 | 5141 |
5150 void Document::popCurrentScript() { | 5142 void Document::popCurrentScript(ScriptLoaderClient* script) { |
5151 DCHECK(!m_currentScriptStack.isEmpty()); | 5143 DCHECK(!m_currentScriptStack.isEmpty()); |
5144 DCHECK(m_currentScriptStack.back().get() == script); | |
hiroshige
2017/03/01 00:58:14
nit: DCHECK_EQ
Nate Chapin
2017/03/01 21:34:58
Done.
| |
5152 m_currentScriptStack.pop_back(); | 5145 m_currentScriptStack.pop_back(); |
5153 } | 5146 } |
5154 | 5147 |
5155 void Document::setTransformSource(std::unique_ptr<TransformSource> source) { | 5148 void Document::setTransformSource(std::unique_ptr<TransformSource> source) { |
5156 m_transformSource = std::move(source); | 5149 m_transformSource = std::move(source); |
5157 } | 5150 } |
5158 | 5151 |
5159 String Document::designMode() const { | 5152 String Document::designMode() const { |
5160 return inDesignMode() ? "on" : "off"; | 5153 return inDesignMode() ? "on" : "off"; |
5161 } | 5154 } |
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5668 if (!contextDocument()->canExecuteScripts(NotAboutToExecuteScript)) | 5661 if (!contextDocument()->canExecuteScripts(NotAboutToExecuteScript)) |
5669 return false; | 5662 return false; |
5670 if (node && node->document() != this && | 5663 if (node && node->document() != this && |
5671 !node->document().allowInlineEventHandler(node, listener, contextURL, | 5664 !node->document().allowInlineEventHandler(node, listener, contextURL, |
5672 contextLine)) | 5665 contextLine)) |
5673 return false; | 5666 return false; |
5674 | 5667 |
5675 return true; | 5668 return true; |
5676 } | 5669 } |
5677 | 5670 |
5678 bool Document::allowExecutingScripts(Node* node) { | 5671 bool Document::allowExecutingScripts(Document* document) { |
5679 // FIXME: Eventually we'd like to evaluate scripts which are inserted into a | 5672 // FIXME: Eventually we'd like to evaluate scripts which are inserted into a |
5680 // viewless document but this'll do for now. | 5673 // viewless document but this'll do for now. |
5681 // See http://bugs.webkit.org/show_bug.cgi?id=5727 | 5674 // See http://bugs.webkit.org/show_bug.cgi?id=5727 |
5682 LocalFrame* frame = executingFrame(); | 5675 LocalFrame* frame = executingFrame(); |
5683 if (!frame) | 5676 if (!frame) |
5684 return false; | 5677 return false; |
5685 if (!node->document().executingFrame()) | 5678 if (!document->executingFrame()) |
5686 return false; | 5679 return false; |
5687 if (!canExecuteScripts(AboutToExecuteScript)) | 5680 if (!canExecuteScripts(AboutToExecuteScript)) |
5688 return false; | 5681 return false; |
5689 return true; | 5682 return true; |
5690 } | 5683 } |
5691 | 5684 |
5692 void Document::enforceSandboxFlags(SandboxFlags mask) { | 5685 void Document::enforceSandboxFlags(SandboxFlags mask) { |
5693 RefPtr<SecurityOrigin> standInOrigin = getSecurityOrigin(); | 5686 RefPtr<SecurityOrigin> standInOrigin = getSecurityOrigin(); |
5694 applySandboxFlags(mask); | 5687 applySandboxFlags(mask); |
5695 // Send a notification if the origin has been updated. | 5688 // Send a notification if the origin has been updated. |
(...skipping 965 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6661 } | 6654 } |
6662 | 6655 |
6663 void showLiveDocumentInstances() { | 6656 void showLiveDocumentInstances() { |
6664 WeakDocumentSet& set = liveDocumentSet(); | 6657 WeakDocumentSet& set = liveDocumentSet(); |
6665 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 6658 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
6666 for (blink::Document* document : set) | 6659 for (blink::Document* document : set) |
6667 fprintf(stderr, "- Document %p URL: %s\n", document, | 6660 fprintf(stderr, "- Document %p URL: %s\n", document, |
6668 document->url().getString().utf8().data()); | 6661 document->url().getString().utf8().data()); |
6669 } | 6662 } |
6670 #endif | 6663 #endif |
OLD | NEW |