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, 2010, 2012 Apple Inc. All r ights reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 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) 2010 Nokia Corporation and/or its subsidiary(-ies) | 8 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) |
9 * Copyright (C) 2013 Google Inc. All rights reserved. | 9 * Copyright (C) 2013 Google Inc. All rights reserved. |
10 * | 10 * |
(...skipping 15 matching lines...) Expand all Loading... | |
26 */ | 26 */ |
27 | 27 |
28 #include "config.h" | 28 #include "config.h" |
29 #include "core/dom/DocumentInit.h" | 29 #include "core/dom/DocumentInit.h" |
30 | 30 |
31 #include "core/html/HTMLImportsController.h" | 31 #include "core/html/HTMLImportsController.h" |
32 #include "core/page/Frame.h" | 32 #include "core/page/Frame.h" |
33 | 33 |
34 namespace WebCore { | 34 namespace WebCore { |
35 | 35 |
36 bool DocumentInit::hasSecurityContextSource() const | |
37 { | |
38 return contextSourceFrame(); | |
39 } | |
40 | |
36 bool DocumentInit::shouldSetURL() const | 41 bool DocumentInit::shouldSetURL() const |
37 { | 42 { |
38 return (m_frame && m_frame->ownerElement()) || !m_url.isEmpty(); | 43 Frame* frame = contextSourceFrame(); |
44 return (frame && frame->ownerElement()) || !m_url.isEmpty(); | |
39 } | 45 } |
40 | 46 |
41 bool DocumentInit::shouldTreatURLAsSrcdocDocument() const | 47 bool DocumentInit::shouldTreatURLAsSrcdocDocument() const |
42 { | 48 { |
43 return m_frame->loader()->shouldTreatURLAsSrcdocDocument(m_url); | 49 return contextSourceFrame()->loader()->shouldTreatURLAsSrcdocDocument(m_url) ; |
44 } | 50 } |
45 | 51 |
46 SandboxFlags DocumentInit::sandboxFlags() const | 52 SandboxFlags DocumentInit::sandboxFlags() const |
47 { | 53 { |
48 return m_frame->loader()->effectiveSandboxFlags(); | 54 return contextSourceFrame()->loader()->effectiveSandboxFlags(); |
49 } | 55 } |
50 | 56 |
51 Settings* DocumentInit::settings() const | 57 Settings* DocumentInit::settings() const |
52 { | 58 { |
53 return m_frame->settings(); | 59 return contextSourceFrame()->settings(); |
54 } | 60 } |
55 | 61 |
56 Frame* DocumentInit::ownerFrame() const | 62 Frame* DocumentInit::ownerFrame() const |
57 { | 63 { |
58 Frame* ownerFrame = m_frame->tree()->parent(); | 64 Frame* ownerFrame = m_frame->tree()->parent(); |
59 if (!ownerFrame) | 65 if (!ownerFrame) |
60 ownerFrame = m_frame->loader()->opener(); | 66 ownerFrame = m_frame->loader()->opener(); |
61 return ownerFrame; | 67 return ownerFrame; |
62 } | 68 } |
63 | 69 |
70 inline Frame* DocumentInit::contextSourceFrame() const | |
abarth-chromium
2013/07/19 07:55:55
Why not just sourceFrame() or just frame() ? I do
| |
71 { | |
72 if (m_frame) | |
73 return m_frame; | |
74 if (m_import) | |
75 return m_import->frame(); | |
76 return 0; | |
77 } | |
78 | |
64 } // namespace WebCore | 79 } // namespace WebCore |
65 | 80 |
OLD | NEW |