Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2009 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
| 5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
| 6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
| 7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
| 8 * | 8 * |
| 9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 74 SandboxFlags m_sandboxFlags; | 74 SandboxFlags m_sandboxFlags; |
| 75 }; | 75 }; |
| 76 | 76 |
| 77 inline Result<HTMLFrameOwnerElement> toFrameOwnerElement(const Handle<Node>& nod e) | 77 inline Result<HTMLFrameOwnerElement> toFrameOwnerElement(const Handle<Node>& nod e) |
| 78 { | 78 { |
| 79 ASSERT_WITH_SECURITY_IMPLICATION(!node || node->isFrameOwnerElement()); | 79 ASSERT_WITH_SECURITY_IMPLICATION(!node || node->isFrameOwnerElement()); |
| 80 return Handle<HTMLFrameOwnerElement>::cast(node); | 80 return Handle<HTMLFrameOwnerElement>::cast(node); |
| 81 } | 81 } |
| 82 | 82 |
| 83 class SubframeLoadingDisabler { | 83 class SubframeLoadingDisabler { |
| 84 DISALLOW_ALLOCATION() | |
| 84 public: | 85 public: |
| 85 explicit SubframeLoadingDisabler(Node* root) | 86 explicit SubframeLoadingDisabler(const Handle<Node>& root) |
| 86 : m_root(root) | 87 : m_root(root) |
| 87 { | 88 { |
| 88 disabledSubtreeRoots().add(m_root); | 89 disabledSubtreeRoots().add(m_root); |
| 89 } | 90 } |
| 90 | 91 |
| 91 ~SubframeLoadingDisabler() | 92 ~SubframeLoadingDisabler() |
| 92 { | 93 { |
| 93 disabledSubtreeRoots().remove(m_root); | 94 disabledSubtreeRoots().remove(m_root); |
| 94 } | 95 } |
| 95 | 96 |
| 96 static bool canLoadFrame(const Handle<HTMLFrameOwnerElement>& owner) | 97 static bool canLoadFrame(const Handle<HTMLFrameOwnerElement>& owner) |
| 97 { | 98 { |
| 98 for (Node* node = owner.raw(); node; node = node->parentOrShadowHostNode ().handle().raw()) { | 99 for (Handle<Node> node = owner; node; node = node->parentOrShadowHostNod e()) { |
| 100 HandleScope scope; | |
| 99 if (disabledSubtreeRoots().contains(node)) | 101 if (disabledSubtreeRoots().contains(node)) |
| 100 return false; | 102 return false; |
| 101 } | 103 } |
| 102 return true; | 104 return true; |
| 103 } | 105 } |
| 104 | 106 |
| 105 private: | 107 private: |
| 106 static HashSet<Node*>& disabledSubtreeRoots() | 108 static HashSet<Member<Node> >& disabledSubtreeRoots() |
| 107 { | 109 { |
| 108 DEFINE_STATIC_LOCAL(HashSet<Node*>, nodes, ()); | 110 // All nodes in the collection are traced individually (via m_root). |
|
haraken
2013/09/12 20:08:14
This observation looks correct, but it's a bit fra
| |
| 111 DEFINE_STATIC_LOCAL(HashSet<Member<Node> >, nodes, ()); | |
| 109 return nodes; | 112 return nodes; |
| 110 } | 113 } |
| 111 | 114 |
| 112 Node* m_root; | 115 Handle<Node> m_root; |
| 113 }; | 116 }; |
| 114 | 117 |
| 115 } // namespace WebCore | 118 } // namespace WebCore |
| 116 | 119 |
| 117 #endif // HTMLFrameOwnerElement_h | 120 #endif // HTMLFrameOwnerElement_h |
| OLD | NEW |