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

Side by Side Diff: Source/WebKit/chromium/src/WebSearchableFormData.cpp

Issue 7782040: Merge 94102 - [Chromium] Add null checks for document()->loader() (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/835/
Patch Set: Created 9 years, 3 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 { 57 {
58 String str(form->getAttribute(HTMLNames::accept_charsetAttr)); 58 String str(form->getAttribute(HTMLNames::accept_charsetAttr));
59 str.replace(',', ' '); 59 str.replace(',', ' ');
60 Vector<String> charsets; 60 Vector<String> charsets;
61 str.split(' ', charsets); 61 str.split(' ', charsets);
62 for (Vector<String>::const_iterator i(charsets.begin()); i != charsets.end() ; ++i) { 62 for (Vector<String>::const_iterator i(charsets.begin()); i != charsets.end() ; ++i) {
63 *encoding = TextEncoding(*i); 63 *encoding = TextEncoding(*i);
64 if (encoding->isValid()) 64 if (encoding->isValid())
65 return; 65 return;
66 } 66 }
67 if (!form->document()->loader())
68 return;
67 *encoding = TextEncoding(form->document()->loader()->writer()->encoding()); 69 *encoding = TextEncoding(form->document()->loader()->writer()->encoding());
68 } 70 }
69 71
70 // Returns true if the submit request results in an HTTP URL. 72 // Returns true if the submit request results in an HTTP URL.
71 bool IsHTTPFormSubmit(const HTMLFormElement* form) 73 bool IsHTTPFormSubmit(const HTMLFormElement* form)
72 { 74 {
73 // FIXME: This function is insane. This is an overly complicated way to get this information. 75 // FIXME: This function is insane. This is an overly complicated way to get this information.
74 String action(form->action()); 76 String action(form->action());
75 // The isNull() check is trying to avoid completeURL returning KURL() when p assed a null string. 77 // The isNull() check is trying to avoid completeURL returning KURL() when p assed a null string.
76 return form->document()->completeURL(action.isNull() ? "" : action).protocol Is("http"); 78 return form->document()->completeURL(action.isNull() ? "" : action).protocol Is("http");
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 288
287 String action(formElement->action()); 289 String action(formElement->action());
288 KURL url(formElement->document()->completeURL(action.isNull() ? "" : action) ); 290 KURL url(formElement->document()->completeURL(action.isNull() ? "" : action) );
289 RefPtr<FormData> formData = FormData::create(encodedString); 291 RefPtr<FormData> formData = FormData::create(encodedString);
290 url.setQuery(formData->flattenToString()); 292 url.setQuery(formData->flattenToString());
291 m_url = url; 293 m_url = url;
292 m_encoding = String(encoding.name()); 294 m_encoding = String(encoding.name());
293 } 295 }
294 296
295 } // namespace WebKit 297 } // namespace WebKit
OLDNEW
« no previous file with comments | « Source/WebKit/chromium/src/ContextMenuClientImpl.cpp ('k') | Source/WebKit/chromium/src/WebViewImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698