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

Side by Side Diff: third_party/WebKit/Source/core/fileapi/Blob.cpp

Issue 2811863002: Move ScriptState::GetExecutionContext (Part 4) (Closed)
Patch Set: Fix Document.cpp Created 3 years, 8 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) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 void Blob::close(ScriptState* script_state, ExceptionState& exception_state) { 194 void Blob::close(ScriptState* script_state, ExceptionState& exception_state) {
195 if (isClosed()) { 195 if (isClosed()) {
196 exception_state.ThrowDOMException(kInvalidStateError, 196 exception_state.ThrowDOMException(kInvalidStateError,
197 "Blob has been closed."); 197 "Blob has been closed.");
198 return; 198 return;
199 } 199 }
200 200
201 // Dereferencing a Blob that has been closed should result in 201 // Dereferencing a Blob that has been closed should result in
202 // a network error. Revoke URLs registered against it through 202 // a network error. Revoke URLs registered against it through
203 // its UUID. 203 // its UUID.
204 DOMURL::RevokeObjectUUID(script_state->GetExecutionContext(), Uuid()); 204 DOMURL::RevokeObjectUUID(ExecutionContext::From(script_state), Uuid());
205 205
206 // A Blob enters a 'readability state' of closed, where it will report its 206 // A Blob enters a 'readability state' of closed, where it will report its
207 // size as zero. Blob and FileReader operations now throws on 207 // size as zero. Blob and FileReader operations now throws on
208 // being passed a Blob in that state. Downstream uses of closed Blobs 208 // being passed a Blob in that state. Downstream uses of closed Blobs
209 // (e.g., XHR.send()) consider them as empty. 209 // (e.g., XHR.send()) consider them as empty.
210 std::unique_ptr<BlobData> blob_data = BlobData::Create(); 210 std::unique_ptr<BlobData> blob_data = BlobData::Create();
211 blob_data->SetContentType(type()); 211 blob_data->SetContentType(type());
212 blob_data_handle_ = BlobDataHandle::Create(std::move(blob_data), 0); 212 blob_data_handle_ = BlobDataHandle::Create(std::move(blob_data), 0);
213 is_closed_ = true; 213 is_closed_ = true;
214 } 214 }
(...skipping 21 matching lines...) Expand all
236 const UChar* chars = type.Characters16(); 236 const UChar* chars = type.Characters16();
237 for (size_t i = 0; i < length; ++i) { 237 for (size_t i = 0; i < length; ++i) {
238 if (chars[i] < 0x0020 || chars[i] > 0x007e) 238 if (chars[i] < 0x0020 || chars[i] > 0x007e)
239 return g_empty_string; 239 return g_empty_string;
240 } 240 }
241 } 241 }
242 return type.DeprecatedLower(); 242 return type.DeprecatedLower();
243 } 243 }
244 244
245 } // namespace blink 245 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/events/Event.cpp ('k') | third_party/WebKit/Source/core/fileapi/FileReaderSync.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698