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 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. |
6 * Copyright (C) 2006 Samuel Weinig (sam@webkit.org) | 6 * Copyright (C) 2006 Samuel Weinig (sam@webkit.org) |
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 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 { | 277 { |
278 if (mimeType == "text/xml" || mimeType == "application/xml" || mimeType == "
text/xsl") | 278 if (mimeType == "text/xml" || mimeType == "application/xml" || mimeType == "
text/xsl") |
279 return true; | 279 return true; |
280 static const char* const validChars = "[0-9a-zA-Z_\\-+~!$\\^{}|.%'`#&*]"; //
per RFCs: 3023, 2045 | 280 static const char* const validChars = "[0-9a-zA-Z_\\-+~!$\\^{}|.%'`#&*]"; //
per RFCs: 3023, 2045 |
281 DEFINE_STATIC_LOCAL(RegularExpression, xmlTypeRegExp, (String("^") + validCh
ars + "+/" + validChars + "+\\+xml$", TextCaseSensitive)); | 281 DEFINE_STATIC_LOCAL(RegularExpression, xmlTypeRegExp, (String("^") + validCh
ars + "+/" + validChars + "+\\+xml$", TextCaseSensitive)); |
282 return xmlTypeRegExp.match(mimeType) > -1; | 282 return xmlTypeRegExp.match(mimeType) > -1; |
283 } | 283 } |
284 | 284 |
285 bool DOMImplementation::isTextMIMEType(const String& mimeType) | 285 bool DOMImplementation::isTextMIMEType(const String& mimeType) |
286 { | 286 { |
287 if (MIMETypeRegistry::isSupportedJavaScriptMIMEType(mimeType) || | 287 if (MIMETypeRegistry::isSupportedJavaScriptMIMEType(mimeType) |
288 (mimeType.startsWith("text/") && mimeType != "text/html" && | 288 || mimeType == "application/json" // Render JSON as text/plain. |
289 mimeType != "text/xml" && mimeType != "text/xsl")) | 289 || (mimeType.startsWith("text/") && mimeType != "text/html" |
| 290 && mimeType != "text/xml" && mimeType != "text/xsl")) |
290 return true; | 291 return true; |
291 | 292 |
292 return false; | 293 return false; |
293 } | 294 } |
294 | 295 |
295 PassRefPtr<HTMLDocument> DOMImplementation::createHTMLDocument(const String& tit
le) | 296 PassRefPtr<HTMLDocument> DOMImplementation::createHTMLDocument(const String& tit
le) |
296 { | 297 { |
297 RefPtr<HTMLDocument> d = HTMLDocument::create(0); | 298 RefPtr<HTMLDocument> d = HTMLDocument::create(0); |
298 d->open(); | 299 d->open(); |
299 d->write("<!doctype html><html><body></body></html>"); | 300 d->write("<!doctype html><html><body></body></html>"); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 return SVGDocument::create(frame); | 362 return SVGDocument::create(frame); |
362 } | 363 } |
363 #endif | 364 #endif |
364 if (isXMLMIMEType(type)) | 365 if (isXMLMIMEType(type)) |
365 return Document::create(frame); | 366 return Document::create(frame); |
366 | 367 |
367 return HTMLDocument::create(frame); | 368 return HTMLDocument::create(frame); |
368 } | 369 } |
369 | 370 |
370 } | 371 } |
OLD | NEW |