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

Side by Side Diff: WebCore/dom/DOMImplementation.cpp

Issue 2845006: Merge 57386 - 2010-04-09 Abhishek Arya <inferno@chromium.org>... (Closed) Base URL: svn://chrome-svn/chrome/branches/WebKit/375/
Patch Set: Created 10 years, 6 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
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) 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
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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698