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