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

Side by Side Diff: Source/bindings/core/v8/V8MutationCallback.cpp

Issue 1100223003: bindings: Add empty checks for toV8() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase Created 5 years, 7 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 if (observerHandle.IsEmpty()) { 66 if (observerHandle.IsEmpty()) {
67 if (!isScriptControllerTerminating()) 67 if (!isScriptControllerTerminating())
68 CRASH(); 68 CRASH();
69 return; 69 return;
70 } 70 }
71 71
72 if (!observerHandle->IsObject()) 72 if (!observerHandle->IsObject())
73 return; 73 return;
74 74
75 v8::Local<v8::Object> thisObject = v8::Local<v8::Object>::Cast(observerHandl e); 75 v8::Local<v8::Object> thisObject = v8::Local<v8::Object>::Cast(observerHandl e);
76 v8::Local<v8::Value> argv[] = { toV8(mutations, m_scriptState->context()->Gl obal(), isolate), observerHandle }; 76 v8::Local<v8::Value> v8Mutations = toV8(mutations, m_scriptState->context()- >Global(), isolate);
77 if (v8Mutations.IsEmpty())
78 return;
79 v8::Local<v8::Value> argv[] = { v8Mutations, observerHandle };
77 80
78 v8::TryCatch exceptionCatcher; 81 v8::TryCatch exceptionCatcher;
79 exceptionCatcher.SetVerbose(true); 82 exceptionCatcher.SetVerbose(true);
80 ScriptController::callFunction(executionContext(), m_callback.newLocal(isola te), thisObject, WTF_ARRAY_LENGTH(argv), argv, isolate); 83 ScriptController::callFunction(executionContext(), m_callback.newLocal(isola te), thisObject, WTF_ARRAY_LENGTH(argv), argv, isolate);
81 } 84 }
82 85
83 void V8MutationCallback::setWeakCallback(const v8::WeakCallbackInfo<V8MutationCa llback>& data) 86 void V8MutationCallback::setWeakCallback(const v8::WeakCallbackInfo<V8MutationCa llback>& data)
84 { 87 {
85 data.GetParameter()->m_callback.clear(); 88 data.GetParameter()->m_callback.clear();
86 } 89 }
87 90
88 DEFINE_TRACE(V8MutationCallback) 91 DEFINE_TRACE(V8MutationCallback)
89 { 92 {
90 MutationCallback::trace(visitor); 93 MutationCallback::trace(visitor);
91 ActiveDOMCallback::trace(visitor); 94 ActiveDOMCallback::trace(visitor);
92 } 95 }
93 96
94 } // namespace blink 97 } // namespace blink
OLDNEW
« no previous file with comments | « Source/bindings/core/v8/V8LazyEventListener.cpp ('k') | Source/bindings/core/v8/V8NodeFilterCondition.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698