Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(32)

Side by Side Diff: Source/core/html/HTMLAppletElement.cpp

Issue 126443005: Use TreeScope::completeURL and baseURL instead of the Document versions (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased again, passes tests Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/html/HTMLAnchorElement.cpp ('k') | Source/core/html/HTMLBodyElement.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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) 2000 Stefan Schimanski (1Stein@gmx.de) 4 * (C) 2000 Stefan Schimanski (1Stein@gmx.de)
5 * Copyright (C) 2004, 2005, 2006, 2008, 2009, 2012 Apple Inc. All rights reserv ed. 5 * Copyright (C) 2004, 2005, 2006, 2008, 2009, 2012 Apple Inc. All rights reserv ed.
6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 LayoutUnit contentWidth = renderer->style()->width().isFixed() ? LayoutUnit( renderer->style()->width().value()) : 120 LayoutUnit contentWidth = renderer->style()->width().isFixed() ? LayoutUnit( renderer->style()->width().value()) :
121 renderer->width() - renderer->borderAndPaddingWidth(); 121 renderer->width() - renderer->borderAndPaddingWidth();
122 LayoutUnit contentHeight = renderer->style()->height().isFixed() ? LayoutUni t(renderer->style()->height().value()) : 122 LayoutUnit contentHeight = renderer->style()->height().isFixed() ? LayoutUni t(renderer->style()->height().value()) :
123 renderer->height() - renderer->borderAndPaddingHeight(); 123 renderer->height() - renderer->borderAndPaddingHeight();
124 124
125 Vector<String> paramNames; 125 Vector<String> paramNames;
126 Vector<String> paramValues; 126 Vector<String> paramValues;
127 127
128 const AtomicString& codeBase = getAttribute(codebaseAttr); 128 const AtomicString& codeBase = getAttribute(codebaseAttr);
129 if (!codeBase.isNull()) { 129 if (!codeBase.isNull()) {
130 KURL codeBaseURL = document().completeURL(codeBase); 130 KURL codeBaseURL = treeScope().completeURL(codeBase);
131 paramNames.append("codeBase"); 131 paramNames.append("codeBase");
132 paramValues.append(codeBase.string()); 132 paramValues.append(codeBase.string());
133 } 133 }
134 134
135 const AtomicString& archive = getAttribute(archiveAttr); 135 const AtomicString& archive = getAttribute(archiveAttr);
136 if (!archive.isNull()) { 136 if (!archive.isNull()) {
137 paramNames.append("archive"); 137 paramNames.append("archive");
138 paramValues.append(archive.string()); 138 paramValues.append(archive.string());
139 } 139 }
140 140
141 const AtomicString& code = getAttribute(codeAttr); 141 const AtomicString& code = getAttribute(codeAttr);
142 paramNames.append("code"); 142 paramNames.append("code");
143 paramValues.append(code.string()); 143 paramValues.append(code.string());
144 144
145 // If the 'codebase' attribute is set, it serves as a relative root for the file that the Java 145 // If the 'codebase' attribute is set, it serves as a relative root for the file that the Java
146 // plugin will load. If the 'code' attribute is set, and the 'archive' is no t set, then we need 146 // plugin will load. If the 'code' attribute is set, and the 'archive' is no t set, then we need
147 // to check the url generated by resolving 'code' against 'codebase'. If the 'archive' 147 // to check the url generated by resolving 'code' against 'codebase'. If the 'archive'
148 // attribute is set, then 'code' points to a class inside the archive, so we need to check the 148 // attribute is set, then 'code' points to a class inside the archive, so we need to check the
149 // url generated by resolving 'archive' against 'codebase'. 149 // url generated by resolving 'archive' against 'codebase'.
150 KURL urlToCheck; 150 KURL urlToCheck;
151 KURL rootURL = codeBase.isNull() ? document().url() : document().completeURL (codeBase); 151 KURL rootURL = codeBase.isNull() ? document().url() : treeScope().completeUR L(codeBase);
152 if (!archive.isNull()) 152 if (!archive.isNull())
153 urlToCheck = KURL(rootURL, archive); 153 urlToCheck = KURL(rootURL, archive);
154 else if (!code.isNull()) 154 else if (!code.isNull())
155 urlToCheck = KURL(rootURL, code); 155 urlToCheck = KURL(rootURL, code);
156 if (!canEmbedURL(urlToCheck)) 156 if (!canEmbedURL(urlToCheck))
157 return; 157 return;
158 158
159 const AtomicString& name = document().isHTMLDocument() ? getNameAttribute() : getIdAttribute(); 159 const AtomicString& name = document().isHTMLDocument() ? getNameAttribute() : getIdAttribute();
160 if (!name.isNull()) { 160 if (!name.isNull()) {
161 paramNames.append("name"); 161 paramNames.append("name");
162 paramValues.append(name.string()); 162 paramValues.append(name.string());
163 } 163 }
164 164
165 paramNames.append("baseURL"); 165 paramNames.append("baseURL");
166 KURL baseURL = document().baseURL(); 166 KURL baseURL = treeScope().baseURL();
167 paramValues.append(baseURL.string()); 167 paramValues.append(baseURL.string());
168 168
169 const AtomicString& mayScript = getAttribute(mayscriptAttr); 169 const AtomicString& mayScript = getAttribute(mayscriptAttr);
170 if (!mayScript.isNull()) { 170 if (!mayScript.isNull()) {
171 paramNames.append("mayScript"); 171 paramNames.append("mayScript");
172 paramValues.append(mayScript.string()); 172 paramValues.append(mayScript.string());
173 } 173 }
174 174
175 for (Node* child = firstChild(); child; child = child->nextSibling()) { 175 for (Node* child = firstChild(); child; child = child->nextSibling()) {
176 if (!child->hasTagName(paramTag)) 176 if (!child->hasTagName(paramTag))
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 223
224 if (!document().contentSecurityPolicy()->allowObjectFromSource(url) 224 if (!document().contentSecurityPolicy()->allowObjectFromSource(url)
225 || !document().contentSecurityPolicy()->allowPluginType(appletMimeType, appletMimeType, url)) { 225 || !document().contentSecurityPolicy()->allowPluginType(appletMimeType, appletMimeType, url)) {
226 renderEmbeddedObject()->setPluginUnavailabilityReason(RenderEmbeddedObje ct::PluginBlockedByContentSecurityPolicy); 226 renderEmbeddedObject()->setPluginUnavailabilityReason(RenderEmbeddedObje ct::PluginBlockedByContentSecurityPolicy);
227 return false; 227 return false;
228 } 228 }
229 return true; 229 return true;
230 } 230 }
231 231
232 } 232 }
OLDNEW
« no previous file with comments | « Source/core/html/HTMLAnchorElement.cpp ('k') | Source/core/html/HTMLBodyElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698