OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 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 886 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
897 { | 897 { |
898 v8::Local<v8::Value> arrayValue = object->GetInternalField(arrayIndex); | 898 v8::Local<v8::Value> arrayValue = object->GetInternalField(arrayIndex); |
899 if (!arrayValue->IsArray()) | 899 if (!arrayValue->IsArray()) |
900 return; | 900 return; |
901 v8::Local<v8::Array> array = v8::Local<v8::Array>::Cast(arrayValue); | 901 v8::Local<v8::Array> array = v8::Local<v8::Array>::Cast(arrayValue); |
902 for (int i = array->Length() - 1; i >= 0; --i) { | 902 for (int i = array->Length() - 1; i >= 0; --i) { |
903 v8::Local<v8::Value> item; | 903 v8::Local<v8::Value> item; |
904 if (!array->Get(isolate->GetCurrentContext(), i).ToLocal(&item)) | 904 if (!array->Get(isolate->GetCurrentContext(), i).ToLocal(&item)) |
905 return; | 905 return; |
906 if (item->StrictEquals(value)) { | 906 if (item->StrictEquals(value)) { |
907 array->Delete(isolate->GetCurrentContext(), i); | 907 if (array->Delete(isolate->GetCurrentContext(), i).IsNothing()) { |
| 908 // TODO: Not sure if this should be logged or an error thrown or |
| 909 // if it is fine to just return |
| 910 } |
908 return; | 911 return; |
909 } | 912 } |
910 } | 913 } |
911 } | 914 } |
912 | 915 |
913 void moveEventListenerToNewWrapper(v8::Isolate* isolate, v8::Local<v8::Object> o
bject, EventListener* oldValue, v8::Local<v8::Value> newValue, int arrayIndex) | 916 void moveEventListenerToNewWrapper(v8::Isolate* isolate, v8::Local<v8::Object> o
bject, EventListener* oldValue, v8::Local<v8::Value> newValue, int arrayIndex) |
914 { | 917 { |
915 if (oldValue) { | 918 if (oldValue) { |
916 V8AbstractEventListener* oldListener = V8AbstractEventListener::cast(old
Value); | 919 V8AbstractEventListener* oldListener = V8AbstractEventListener::cast(old
Value); |
917 if (oldListener) { | 920 if (oldListener) { |
(...skipping 30 matching lines...) Expand all Loading... |
948 v8SetReturnValue(info, perContextData->constructorForType(WrapperTypeInfo::u
nwrap(data))); | 951 v8SetReturnValue(info, perContextData->constructorForType(WrapperTypeInfo::u
nwrap(data))); |
949 } | 952 } |
950 | 953 |
951 v8::Local<v8::Value> freezeV8Object(v8::Local<v8::Value> value, v8::Isolate* iso
late) | 954 v8::Local<v8::Value> freezeV8Object(v8::Local<v8::Value> value, v8::Isolate* iso
late) |
952 { | 955 { |
953 v8CallOrCrash(value.As<v8::Object>()->SetIntegrityLevel(isolate->GetCurrentC
ontext(), v8::IntegrityLevel::kFrozen)); | 956 v8CallOrCrash(value.As<v8::Object>()->SetIntegrityLevel(isolate->GetCurrentC
ontext(), v8::IntegrityLevel::kFrozen)); |
954 return value; | 957 return value; |
955 } | 958 } |
956 | 959 |
957 } // namespace blink | 960 } // namespace blink |
OLD | NEW |