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

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/V8NodeFilterCondition.cpp

Issue 2571063002: Remove Blink-in-JS (Closed)
Patch Set: Created 4 years 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) 2008, 2009 Google Inc. All rights reserved. 2 * Copyright (C) 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 67
68 ASSERT(filter.IsEmpty() || filter->IsObject()); 68 ASSERT(filter.IsEmpty() || filter->IsObject());
69 if (filter.IsEmpty()) 69 if (filter.IsEmpty())
70 return NodeFilter::kFilterAccept; 70 return NodeFilter::kFilterAccept;
71 71
72 v8::TryCatch exceptionCatcher(isolate); 72 v8::TryCatch exceptionCatcher(isolate);
73 73
74 v8::Local<v8::Function> callback; 74 v8::Local<v8::Function> callback;
75 v8::Local<v8::Value> receiver; 75 v8::Local<v8::Value> receiver;
76 if (filter->IsFunction()) { 76 if (filter->IsFunction()) {
77 UseCounter::countIfNotPrivateScript(isolate, 77 UseCounter::count(currentExecutionContext(isolate),
78 currentExecutionContext(isolate), 78 UseCounter::NodeFilterIsFunction);
79 UseCounter::NodeFilterIsFunction);
80 callback = v8::Local<v8::Function>::Cast(filter); 79 callback = v8::Local<v8::Function>::Cast(filter);
81 receiver = v8::Undefined(isolate); 80 receiver = v8::Undefined(isolate);
82 } else { 81 } else {
83 v8::Local<v8::Object> filterObject; 82 v8::Local<v8::Object> filterObject;
84 if (!filter->ToObject(m_scriptState->context()).ToLocal(&filterObject)) { 83 if (!filter->ToObject(m_scriptState->context()).ToLocal(&filterObject)) {
85 exceptionState.throwTypeError("NodeFilter is not an object"); 84 exceptionState.throwTypeError("NodeFilter is not an object");
86 return NodeFilter::kFilterReject; 85 return NodeFilter::kFilterReject;
87 } 86 }
88 v8::Local<v8::Value> value; 87 v8::Local<v8::Value> value;
89 if (!filterObject 88 if (!filterObject
90 ->Get(m_scriptState->context(), 89 ->Get(m_scriptState->context(),
91 v8AtomicString(isolate, "acceptNode")) 90 v8AtomicString(isolate, "acceptNode"))
92 .ToLocal(&value) || 91 .ToLocal(&value) ||
93 !value->IsFunction()) { 92 !value->IsFunction()) {
94 exceptionState.throwTypeError( 93 exceptionState.throwTypeError(
95 "NodeFilter object does not have an acceptNode function"); 94 "NodeFilter object does not have an acceptNode function");
96 return NodeFilter::kFilterReject; 95 return NodeFilter::kFilterReject;
97 } 96 }
98 UseCounter::countIfNotPrivateScript(isolate, 97 UseCounter::count(currentExecutionContext(isolate),
99 currentExecutionContext(isolate), 98 UseCounter::NodeFilterIsObject);
100 UseCounter::NodeFilterIsObject);
101 callback = v8::Local<v8::Function>::Cast(value); 99 callback = v8::Local<v8::Function>::Cast(value);
102 receiver = filter; 100 receiver = filter;
103 } 101 }
104 102
105 v8::Local<v8::Value> nodeWrapper = toV8(node, m_scriptState.get()); 103 v8::Local<v8::Value> nodeWrapper = toV8(node, m_scriptState.get());
106 if (nodeWrapper.IsEmpty()) { 104 if (nodeWrapper.IsEmpty()) {
107 if (exceptionCatcher.HasCaught()) 105 if (exceptionCatcher.HasCaught())
108 exceptionState.rethrowV8Exception(exceptionCatcher.Exception()); 106 exceptionState.rethrowV8Exception(exceptionCatcher.Exception());
109 return NodeFilter::kFilterReject; 107 return NodeFilter::kFilterReject;
110 } 108 }
(...skipping 13 matching lines...) Expand all
124 uint32_t uint32Value; 122 uint32_t uint32Value;
125 if (!v8Call(result->Uint32Value(m_scriptState->context()), uint32Value, 123 if (!v8Call(result->Uint32Value(m_scriptState->context()), uint32Value,
126 exceptionCatcher)) { 124 exceptionCatcher)) {
127 exceptionState.rethrowV8Exception(exceptionCatcher.Exception()); 125 exceptionState.rethrowV8Exception(exceptionCatcher.Exception());
128 return NodeFilter::kFilterReject; 126 return NodeFilter::kFilterReject;
129 } 127 }
130 return uint32Value; 128 return uint32Value;
131 } 129 }
132 130
133 } // namespace blink 131 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698