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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 RawPtrWillBeMember<Frame> m_contentFrame; | 102 RawPtrWillBeMember<Frame> m_contentFrame; |
103 RefPtrWillBeMember<Widget> m_widget; | 103 RefPtrWillBeMember<Widget> m_widget; |
104 SandboxFlags m_sandboxFlags; | 104 SandboxFlags m_sandboxFlags; |
105 }; | 105 }; |
106 | 106 |
107 DEFINE_ELEMENT_TYPE_CASTS(HTMLFrameOwnerElement, isFrameOwnerElement()); | 107 DEFINE_ELEMENT_TYPE_CASTS(HTMLFrameOwnerElement, isFrameOwnerElement()); |
108 | 108 |
109 class SubframeLoadingDisabler { | 109 class SubframeLoadingDisabler { |
110 STACK_ALLOCATED(); | 110 STACK_ALLOCATED(); |
111 public: | 111 public: |
112 explicit SubframeLoadingDisabler(Node& root) | 112 explicit SubframeLoadingDisabler(Node& root) : SubframeLoadingDisabler(&root
) |
| 113 { |
| 114 } |
| 115 |
| 116 explicit SubframeLoadingDisabler(Node* root) |
113 : m_root(root) | 117 : m_root(root) |
114 { | 118 { |
115 disabledSubtreeRoots().add(m_root); | 119 if (m_root) |
| 120 disabledSubtreeRoots().add(m_root); |
116 } | 121 } |
117 | 122 |
118 ~SubframeLoadingDisabler() | 123 ~SubframeLoadingDisabler() |
119 { | 124 { |
120 disabledSubtreeRoots().remove(m_root); | 125 if (m_root) |
| 126 disabledSubtreeRoots().remove(m_root); |
121 } | 127 } |
122 | 128 |
123 static bool canLoadFrame(HTMLFrameOwnerElement& owner) | 129 static bool canLoadFrame(HTMLFrameOwnerElement& owner) |
124 { | 130 { |
125 if (owner.document().unloadStarted()) | |
126 return false; | |
127 for (Node* node = &owner; node; node = node->parentOrShadowHostNode()) { | 131 for (Node* node = &owner; node; node = node->parentOrShadowHostNode()) { |
128 if (disabledSubtreeRoots().contains(node)) | 132 if (disabledSubtreeRoots().contains(node)) |
129 return false; | 133 return false; |
130 } | 134 } |
131 return true; | 135 return true; |
132 } | 136 } |
133 | 137 |
134 private: | 138 private: |
135 static WillBeHeapHashCountedSet<RawPtrWillBeMember<Node>>& disabledSubtreeRo
ots(); | 139 static WillBeHeapHashCountedSet<RawPtrWillBeMember<Node>>& disabledSubtreeRo
ots(); |
136 | 140 |
137 RawPtrWillBeMember<Node> m_root; | 141 RawPtrWillBeMember<Node> m_root; |
138 }; | 142 }; |
139 | 143 |
140 DEFINE_TYPE_CASTS(HTMLFrameOwnerElement, FrameOwner, owner, owner->isLocal(), ow
ner.isLocal()); | 144 DEFINE_TYPE_CASTS(HTMLFrameOwnerElement, FrameOwner, owner, owner->isLocal(), ow
ner.isLocal()); |
141 | 145 |
142 } // namespace blink | 146 } // namespace blink |
143 | 147 |
144 #endif // HTMLFrameOwnerElement_h | 148 #endif // HTMLFrameOwnerElement_h |
OLD | NEW |