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 986 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
997 | 997 |
998 v8::Local<v8::Value> freezeV8Object(v8::Local<v8::Value> value, | 998 v8::Local<v8::Value> freezeV8Object(v8::Local<v8::Value> value, |
999 v8::Isolate* isolate) { | 999 v8::Isolate* isolate) { |
1000 value.As<v8::Object>() | 1000 value.As<v8::Object>() |
1001 ->SetIntegrityLevel(isolate->GetCurrentContext(), | 1001 ->SetIntegrityLevel(isolate->GetCurrentContext(), |
1002 v8::IntegrityLevel::kFrozen) | 1002 v8::IntegrityLevel::kFrozen) |
1003 .ToChecked(); | 1003 .ToChecked(); |
1004 return value; | 1004 return value; |
1005 } | 1005 } |
1006 | 1006 |
| 1007 v8::Local<v8::Value> fromJSONString(v8::Isolate* isolate, |
| 1008 const String& stringifiedJSON, |
| 1009 ExceptionState& exceptionState) { |
| 1010 v8::Local<v8::Value> parsed; |
| 1011 v8::TryCatch tryCatch(isolate); |
| 1012 if (!v8Call(v8::JSON::Parse(isolate, v8String(isolate, stringifiedJSON)), |
| 1013 parsed, tryCatch)) { |
| 1014 if (tryCatch.HasCaught()) |
| 1015 exceptionState.rethrowV8Exception(tryCatch.Exception()); |
| 1016 } |
| 1017 |
| 1018 return parsed; |
| 1019 } |
| 1020 |
1007 } // namespace blink | 1021 } // namespace blink |
OLD | NEW |