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 5112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5123 UseCounter::count(*this, osdDisposition); | 5123 UseCounter::count(*this, osdDisposition); |
5124 | 5124 |
5125 return linkElement->href(); | 5125 return linkElement->href(); |
5126 } | 5126 } |
5127 | 5127 |
5128 return KURL(); | 5128 return KURL(); |
5129 } | 5129 } |
5130 | 5130 |
5131 void Document::currentScriptForBinding( | 5131 void Document::currentScriptForBinding( |
5132 HTMLScriptElementOrSVGScriptElement& scriptElement) const { | 5132 HTMLScriptElementOrSVGScriptElement& scriptElement) const { |
5133 if (Element* script = currentScript()) { | 5133 if (!m_currentScriptStack.isEmpty()) |
5134 if (script->isInV1ShadowTree()) | 5134 m_currentScriptStack.back()->setScriptElementForBinding(scriptElement); |
5135 return; | |
5136 if (isHTMLScriptElement(script)) | |
5137 scriptElement.setHTMLScriptElement(toHTMLScriptElement(script)); | |
5138 else if (isSVGScriptElement(script)) | |
5139 scriptElement.setSVGScriptElement(toSVGScriptElement(script)); | |
5140 } | |
5141 } | 5135 } |
5142 | 5136 |
5143 void Document::pushCurrentScript(Element* newCurrentScript) { | 5137 void Document::pushCurrentScript(ScriptElementBase* newCurrentScript) { |
5144 DCHECK(isHTMLScriptElement(newCurrentScript) || | |
5145 isSVGScriptElement(newCurrentScript)); | |
5146 m_currentScriptStack.push_back(newCurrentScript); | 5138 m_currentScriptStack.push_back(newCurrentScript); |
5147 } | 5139 } |
5148 | 5140 |
5149 void Document::popCurrentScript() { | 5141 void Document::popCurrentScript(ScriptElementBase* script) { |
5150 DCHECK(!m_currentScriptStack.isEmpty()); | 5142 DCHECK(!m_currentScriptStack.isEmpty()); |
| 5143 DCHECK_EQ(m_currentScriptStack.back(), script); |
5151 m_currentScriptStack.pop_back(); | 5144 m_currentScriptStack.pop_back(); |
5152 } | 5145 } |
5153 | 5146 |
5154 void Document::setTransformSource(std::unique_ptr<TransformSource> source) { | 5147 void Document::setTransformSource(std::unique_ptr<TransformSource> source) { |
5155 m_transformSource = std::move(source); | 5148 m_transformSource = std::move(source); |
5156 } | 5149 } |
5157 | 5150 |
5158 String Document::designMode() const { | 5151 String Document::designMode() const { |
5159 return inDesignMode() ? "on" : "off"; | 5152 return inDesignMode() ? "on" : "off"; |
5160 } | 5153 } |
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5672 if (!contextDocument()->canExecuteScripts(NotAboutToExecuteScript)) | 5665 if (!contextDocument()->canExecuteScripts(NotAboutToExecuteScript)) |
5673 return false; | 5666 return false; |
5674 if (node && node->document() != this && | 5667 if (node && node->document() != this && |
5675 !node->document().allowInlineEventHandler(node, listener, contextURL, | 5668 !node->document().allowInlineEventHandler(node, listener, contextURL, |
5676 contextLine)) | 5669 contextLine)) |
5677 return false; | 5670 return false; |
5678 | 5671 |
5679 return true; | 5672 return true; |
5680 } | 5673 } |
5681 | 5674 |
5682 bool Document::allowExecutingScripts(Node* node) { | |
5683 // FIXME: Eventually we'd like to evaluate scripts which are inserted into a | |
5684 // viewless document but this'll do for now. | |
5685 // See http://bugs.webkit.org/show_bug.cgi?id=5727 | |
5686 LocalFrame* frame = executingFrame(); | |
5687 if (!frame) | |
5688 return false; | |
5689 if (!node->document().executingFrame()) | |
5690 return false; | |
5691 if (!canExecuteScripts(AboutToExecuteScript)) | |
5692 return false; | |
5693 return true; | |
5694 } | |
5695 | |
5696 void Document::enforceSandboxFlags(SandboxFlags mask) { | 5675 void Document::enforceSandboxFlags(SandboxFlags mask) { |
5697 RefPtr<SecurityOrigin> standInOrigin = getSecurityOrigin(); | 5676 RefPtr<SecurityOrigin> standInOrigin = getSecurityOrigin(); |
5698 applySandboxFlags(mask); | 5677 applySandboxFlags(mask); |
5699 // Send a notification if the origin has been updated. | 5678 // Send a notification if the origin has been updated. |
5700 if (standInOrigin && !standInOrigin->isUnique() && | 5679 if (standInOrigin && !standInOrigin->isUnique() && |
5701 getSecurityOrigin()->isUnique()) { | 5680 getSecurityOrigin()->isUnique()) { |
5702 getSecurityOrigin()->setUniqueOriginIsPotentiallyTrustworthy( | 5681 getSecurityOrigin()->setUniqueOriginIsPotentiallyTrustworthy( |
5703 standInOrigin->isPotentiallyTrustworthy()); | 5682 standInOrigin->isPotentiallyTrustworthy()); |
5704 if (frame()) | 5683 if (frame()) |
5705 frame()->loader().client()->didUpdateToUniqueOrigin(); | 5684 frame()->loader().client()->didUpdateToUniqueOrigin(); |
(...skipping 972 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6678 } | 6657 } |
6679 | 6658 |
6680 void showLiveDocumentInstances() { | 6659 void showLiveDocumentInstances() { |
6681 WeakDocumentSet& set = liveDocumentSet(); | 6660 WeakDocumentSet& set = liveDocumentSet(); |
6682 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 6661 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
6683 for (blink::Document* document : set) | 6662 for (blink::Document* document : set) |
6684 fprintf(stderr, "- Document %p URL: %s\n", document, | 6663 fprintf(stderr, "- Document %p URL: %s\n", document, |
6685 document->url().getString().utf8().data()); | 6664 document->url().getString().utf8().data()); |
6686 } | 6665 } |
6687 #endif | 6666 #endif |
OLD | NEW |