| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006 Eric Seidel <eric@webkit.org> | 2 * Copyright (C) 2006 Eric Seidel <eric@webkit.org> |
| 3 * Copyright (C) 2008, 2009 Apple Inc. All rights reserved. | 3 * Copyright (C) 2008, 2009 Apple Inc. All rights reserved. |
| 4 * Copyright (C) Research In Motion Limited 2011. All rights reserved. | 4 * Copyright (C) Research In Motion Limited 2011. All rights reserved. |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 bool SVGImage::IsInSVGImage(const Node* node) { | 114 bool SVGImage::IsInSVGImage(const Node* node) { |
| 115 DCHECK(node); | 115 DCHECK(node); |
| 116 | 116 |
| 117 Page* page = node->GetDocument().GetPage(); | 117 Page* page = node->GetDocument().GetPage(); |
| 118 if (!page) | 118 if (!page) |
| 119 return false; | 119 return false; |
| 120 | 120 |
| 121 return page->GetChromeClient().IsSVGImageChromeClient(); | 121 return page->GetChromeClient().IsSVGImageChromeClient(); |
| 122 } | 122 } |
| 123 | 123 |
| 124 void SVGImage::CheckLoaded() const { |
| 125 CHECK(page_); |
| 126 |
| 127 LocalFrame* frame = ToLocalFrame(page_->MainFrame()); |
| 128 |
| 129 // Failures of this assertion might result in wrong origin tainting checks, |
| 130 // because CurrentFrameHasSingleSecurityOrigin() assumes all subresources of |
| 131 // the SVG are loaded and thus ready for origin checks. |
| 132 CHECK(frame->GetDocument()->LoadEventFinished()); |
| 133 } |
| 134 |
| 124 bool SVGImage::CurrentFrameHasSingleSecurityOrigin() const { | 135 bool SVGImage::CurrentFrameHasSingleSecurityOrigin() const { |
| 125 if (!page_) | 136 if (!page_) |
| 126 return true; | 137 return true; |
| 127 | 138 |
| 128 LocalFrame* frame = ToLocalFrame(page_->MainFrame()); | 139 LocalFrame* frame = ToLocalFrame(page_->MainFrame()); |
| 129 | 140 |
| 130 CHECK(frame->GetDocument()->LoadEventFinished()); | 141 CheckLoaded(); |
| 131 | 142 |
| 132 SVGSVGElement* root_element = | 143 SVGSVGElement* root_element = |
| 133 frame->GetDocument()->AccessSVGExtensions().rootElement(); | 144 frame->GetDocument()->AccessSVGExtensions().rootElement(); |
| 134 if (!root_element) | 145 if (!root_element) |
| 135 return true; | 146 return true; |
| 136 | 147 |
| 137 // Don't allow foreignObject elements or images that are not known to be | 148 // Don't allow foreignObject elements or images that are not known to be |
| 138 // single-origin since these can leak cross-origin information. | 149 // single-origin since these can leak cross-origin information. |
| 139 for (Node* node = root_element; node; node = FlatTreeTraversal::Next(*node)) { | 150 for (Node* node = root_element; node; node = FlatTreeTraversal::Next(*node)) { |
| 140 if (isSVGForeignObjectElement(*node)) | 151 if (isSVGForeignObjectElement(*node)) |
| (...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 774 | 785 |
| 775 NOTREACHED(); | 786 NOTREACHED(); |
| 776 return kSizeAvailable; | 787 return kSizeAvailable; |
| 777 } | 788 } |
| 778 | 789 |
| 779 String SVGImage::FilenameExtension() const { | 790 String SVGImage::FilenameExtension() const { |
| 780 return "svg"; | 791 return "svg"; |
| 781 } | 792 } |
| 782 | 793 |
| 783 } // namespace blink | 794 } // namespace blink |
| OLD | NEW |