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

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/ScriptValueSerializer.cpp

Issue 2249853008: Reject createImageBitmap promise when the cropRect or resize is too big (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update tests Created 4 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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "bindings/core/v8/ScriptValueSerializer.h" 5 #include "bindings/core/v8/ScriptValueSerializer.h"
6 6
7 #include "bindings/core/v8/Transferables.h" 7 #include "bindings/core/v8/Transferables.h"
8 #include "bindings/core/v8/V8ArrayBuffer.h" 8 #include "bindings/core/v8/V8ArrayBuffer.h"
9 #include "bindings/core/v8/V8ArrayBufferView.h" 9 #include "bindings/core/v8/V8ArrayBufferView.h"
10 #include "bindings/core/v8/V8Blob.h" 10 #include "bindings/core/v8/V8Blob.h"
(...skipping 1116 matching lines...) Expand 10 before | Expand all | Expand 10 after
1127 if (!imageBitmap) 1127 if (!imageBitmap)
1128 return nullptr; 1128 return nullptr;
1129 if (imageBitmap->isNeutered()) 1129 if (imageBitmap->isNeutered())
1130 return handleError(Status::DataCloneError, "An ImageBitmap is detached a nd could not be cloned.", next); 1130 return handleError(Status::DataCloneError, "An ImageBitmap is detached a nd could not be cloned.", next);
1131 1131
1132 uint32_t index; 1132 uint32_t index;
1133 if (m_transferredImageBitmaps.tryGet(object, &index)) { 1133 if (m_transferredImageBitmaps.tryGet(object, &index)) {
1134 m_writer.writeTransferredImageBitmap(index); 1134 m_writer.writeTransferredImageBitmap(index);
1135 } else { 1135 } else {
1136 greyObject(object); 1136 greyObject(object);
1137 std::unique_ptr<uint8_t[]> pixelData = imageBitmap->copyBitmapData(image Bitmap->isPremultiplied() ? PremultiplyAlpha : DontPremultiplyAlpha, N32ColorTyp e); 1137 RefPtr<Uint8Array> pixelData = imageBitmap->copyBitmapData(imageBitmap-> isPremultiplied() ? PremultiplyAlpha : DontPremultiplyAlpha, N32ColorType);
1138 m_writer.writeImageBitmap(imageBitmap->width(), imageBitmap->height(), s tatic_cast<uint32_t>(imageBitmap->originClean()), static_cast<uint32_t>(imageBit map->isPremultiplied()), pixelData.get(), imageBitmap->width() * imageBitmap->he ight() * 4); 1138 m_writer.writeImageBitmap(imageBitmap->width(), imageBitmap->height(), s tatic_cast<uint32_t>(imageBitmap->originClean()), static_cast<uint32_t>(imageBit map->isPremultiplied()), pixelData->data(), imageBitmap->width() * imageBitmap-> height() * 4);
1139 } 1139 }
1140 return nullptr; 1140 return nullptr;
1141 } 1141 }
1142 1142
1143 void ScriptValueSerializer::writeRegExp(v8::Local<v8::Value> value) 1143 void ScriptValueSerializer::writeRegExp(v8::Local<v8::Value> value)
1144 { 1144 {
1145 v8::Local<v8::RegExp> regExp = value.As<v8::RegExp>(); 1145 v8::Local<v8::RegExp> regExp = value.As<v8::RegExp>();
1146 m_writer.writeRegExp(regExp->GetSource(), regExp->GetFlags()); 1146 m_writer.writeRegExp(regExp->GetSource(), regExp->GetFlags());
1147 } 1147 }
1148 1148
(...skipping 1298 matching lines...) Expand 10 before | Expand all | Expand 10 after
2447 return false; 2447 return false;
2448 uint32_t objectReference = m_openCompositeReferenceStack[m_openCompositeRefe renceStack.size() - 1]; 2448 uint32_t objectReference = m_openCompositeReferenceStack[m_openCompositeRefe renceStack.size() - 1];
2449 m_openCompositeReferenceStack.shrink(m_openCompositeReferenceStack.size() - 1); 2449 m_openCompositeReferenceStack.shrink(m_openCompositeReferenceStack.size() - 1);
2450 if (objectReference >= m_objectPool.size()) 2450 if (objectReference >= m_objectPool.size())
2451 return false; 2451 return false;
2452 *object = m_objectPool[objectReference]; 2452 *object = m_objectPool[objectReference];
2453 return true; 2453 return true;
2454 } 2454 }
2455 2455
2456 } // namespace blink 2456 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698