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 933 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
944 addHiddenValueToArray(isolate, object, newValue, arrayIndex); | 944 addHiddenValueToArray(isolate, object, newValue, arrayIndex); |
945 } | 945 } |
946 | 946 |
947 v8::Isolate* toIsolate(ExecutionContext* context) { | 947 v8::Isolate* toIsolate(ExecutionContext* context) { |
948 if (context && context->isDocument()) | 948 if (context && context->isDocument()) |
949 return V8PerIsolateData::mainThreadIsolate(); | 949 return V8PerIsolateData::mainThreadIsolate(); |
950 return v8::Isolate::GetCurrent(); | 950 return v8::Isolate::GetCurrent(); |
951 } | 951 } |
952 | 952 |
953 v8::Isolate* toIsolate(LocalFrame* frame) { | 953 v8::Isolate* toIsolate(LocalFrame* frame) { |
954 ASSERT(frame); | 954 DCHECK(frame); |
955 return frame->script().isolate(); | 955 return frame->getWindowProxyManager()->isolate(); |
956 } | 956 } |
957 | 957 |
958 v8::Local<v8::Value> freezeV8Object(v8::Local<v8::Value> value, | 958 v8::Local<v8::Value> freezeV8Object(v8::Local<v8::Value> value, |
959 v8::Isolate* isolate) { | 959 v8::Isolate* isolate) { |
960 value.As<v8::Object>() | 960 value.As<v8::Object>() |
961 ->SetIntegrityLevel(isolate->GetCurrentContext(), | 961 ->SetIntegrityLevel(isolate->GetCurrentContext(), |
962 v8::IntegrityLevel::kFrozen) | 962 v8::IntegrityLevel::kFrozen) |
963 .ToChecked(); | 963 .ToChecked(); |
964 return value; | 964 return value; |
965 } | 965 } |
966 | 966 |
967 v8::Local<v8::Value> fromJSONString(v8::Isolate* isolate, | 967 v8::Local<v8::Value> fromJSONString(v8::Isolate* isolate, |
968 const String& stringifiedJSON, | 968 const String& stringifiedJSON, |
969 ExceptionState& exceptionState) { | 969 ExceptionState& exceptionState) { |
970 v8::Local<v8::Value> parsed; | 970 v8::Local<v8::Value> parsed; |
971 v8::TryCatch tryCatch(isolate); | 971 v8::TryCatch tryCatch(isolate); |
972 if (!v8Call(v8::JSON::Parse(isolate, v8String(isolate, stringifiedJSON)), | 972 if (!v8Call(v8::JSON::Parse(isolate, v8String(isolate, stringifiedJSON)), |
973 parsed, tryCatch)) { | 973 parsed, tryCatch)) { |
974 if (tryCatch.HasCaught()) | 974 if (tryCatch.HasCaught()) |
975 exceptionState.rethrowV8Exception(tryCatch.Exception()); | 975 exceptionState.rethrowV8Exception(tryCatch.Exception()); |
976 } | 976 } |
977 | 977 |
978 return parsed; | 978 return parsed; |
979 } | 979 } |
980 | 980 |
981 } // namespace blink | 981 } // namespace blink |
OLD | NEW |