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

Unified Diff: sky/engine/tonic/dart_exception_factory.cc

Issue 934863002: ParentNode#appendChild(null) shouldn't crash (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: git cl format Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sky/engine/tonic/dart_exception_factory.h ('k') | sky/engine/tonic/dart_state.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/engine/tonic/dart_exception_factory.cc
diff --git a/sky/engine/tonic/dart_exception_factory.cc b/sky/engine/tonic/dart_exception_factory.cc
new file mode 100644
index 0000000000000000000000000000000000000000..52b57092792c306ad638e3a4b12268390a722e4f
--- /dev/null
+++ b/sky/engine/tonic/dart_exception_factory.cc
@@ -0,0 +1,34 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "sky/engine/config.h"
+#include "sky/engine/tonic/dart_exception_factory.h"
+
+#include "sky/engine/tonic/dart_converter.h"
+#include "sky/engine/tonic/dart_builtin.h"
+
+namespace blink {
+
+DartExceptionFactory::DartExceptionFactory(DartState* dart_state)
+ : dart_state_(dart_state) {
+}
+
+DartExceptionFactory::~DartExceptionFactory() {
+}
+
+Dart_Handle DartExceptionFactory::CreateException(const String& class_name,
+ const String& message) {
+ if (core_library_.is_empty()) {
+ Dart_Handle library = DartBuiltin::LookupLibrary("dart:core");
+ core_library_.Set(dart_state_, library);
+ }
+
+ Dart_Handle exception_class = Dart_GetType(
+ core_library_.value(), StringToDart(dart_state_, class_name), 0, 0);
+ Dart_Handle message_handle = StringToDart(dart_state_, message);
+ Dart_Handle empty_string = Dart_NewStringFromCString("");
esprehn 2015/02/17 18:06:53 Do we want a shared per isolate empty string? Exce
abarth-chromium 2015/02/17 18:14:05 It looks like Dart_NewStringFromCString("") is rel
+ return Dart_New(exception_class, empty_string, 1, &message_handle);
+}
+
+} // namespace blink
« no previous file with comments | « sky/engine/tonic/dart_exception_factory.h ('k') | sky/engine/tonic/dart_state.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698