| OLD | NEW |
| 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 callback = v8::Handle<v8::Function>::Cast(filter); | 70 callback = v8::Handle<v8::Function>::Cast(filter); |
| 71 else { | 71 else { |
| 72 v8::Local<v8::Value> value = filter->ToObject()->Get(v8::String::NewSymb
ol("acceptNode")); | 72 v8::Local<v8::Value> value = filter->ToObject()->Get(v8::String::NewSymb
ol("acceptNode")); |
| 73 if (!value->IsFunction()) { | 73 if (!value->IsFunction()) { |
| 74 throwTypeError("NodeFilter object does not have an acceptNode functi
on", state->isolate()); | 74 throwTypeError("NodeFilter object does not have an acceptNode functi
on", state->isolate()); |
| 75 return NodeFilter::FILTER_REJECT; | 75 return NodeFilter::FILTER_REJECT; |
| 76 } | 76 } |
| 77 callback = v8::Handle<v8::Function>::Cast(value); | 77 callback = v8::Handle<v8::Function>::Cast(value); |
| 78 } | 78 } |
| 79 | 79 |
| 80 OwnPtr<v8::Handle<v8::Value>[]> args = adoptArrayPtr(new v8::Handle<v8::Valu
e>[1]); | 80 OwnPtr<v8::Handle<v8::Value>[]> info = adoptArrayPtr(new v8::Handle<v8::Valu
e>[1]); |
| 81 args[0] = toV8(node, v8::Handle<v8::Object>(), state->isolate()); | 81 info[0] = toV8(node, v8::Handle<v8::Object>(), state->isolate()); |
| 82 | 82 |
| 83 v8::Handle<v8::Object> object = v8::Context::GetCurrent()->Global(); | 83 v8::Handle<v8::Object> object = v8::Context::GetCurrent()->Global(); |
| 84 v8::Handle<v8::Value> result = ScriptController::callFunction(state->executi
onContext(), callback, object, 1, args.get(), isolate); | 84 v8::Handle<v8::Value> result = ScriptController::callFunction(state->executi
onContext(), callback, object, 1, info.get(), isolate); |
| 85 | 85 |
| 86 if (exceptionCatcher.HasCaught()) { | 86 if (exceptionCatcher.HasCaught()) { |
| 87 state->setException(exceptionCatcher.Exception()); | 87 state->setException(exceptionCatcher.Exception()); |
| 88 return NodeFilter::FILTER_REJECT; | 88 return NodeFilter::FILTER_REJECT; |
| 89 } | 89 } |
| 90 | 90 |
| 91 ASSERT(!result.IsEmpty()); | 91 ASSERT(!result.IsEmpty()); |
| 92 | 92 |
| 93 return result->Int32Value(); | 93 return result->Int32Value(); |
| 94 } | 94 } |
| 95 | 95 |
| 96 void V8NodeFilterCondition::makeWeakCallback(v8::Isolate*, v8::Persistent<v8::Va
lue>*, V8NodeFilterCondition* condition) | 96 void V8NodeFilterCondition::makeWeakCallback(v8::Isolate*, v8::Persistent<v8::Va
lue>*, V8NodeFilterCondition* condition) |
| 97 { | 97 { |
| 98 condition->m_filter.clear(); | 98 condition->m_filter.clear(); |
| 99 } | 99 } |
| 100 | 100 |
| 101 } // namespace WebCore | 101 } // namespace WebCore |
| OLD | NEW |