| 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 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 698 PassRefPtrWillBeRawPtr<XPathNSResolver> toXPathNSResolver(v8::Isolate* isolate,
v8::Handle<v8::Value> value) | 698 PassRefPtrWillBeRawPtr<XPathNSResolver> toXPathNSResolver(v8::Isolate* isolate,
v8::Handle<v8::Value> value) |
| 699 { | 699 { |
| 700 RefPtrWillBeRawPtr<XPathNSResolver> resolver = nullptr; | 700 RefPtrWillBeRawPtr<XPathNSResolver> resolver = nullptr; |
| 701 if (V8XPathNSResolver::hasInstance(value, isolate)) | 701 if (V8XPathNSResolver::hasInstance(value, isolate)) |
| 702 resolver = V8XPathNSResolver::toImpl(v8::Handle<v8::Object>::Cast(value)
); | 702 resolver = V8XPathNSResolver::toImpl(v8::Handle<v8::Object>::Cast(value)
); |
| 703 else if (value->IsObject()) | 703 else if (value->IsObject()) |
| 704 resolver = V8CustomXPathNSResolver::create(value->ToObject(isolate), iso
late); | 704 resolver = V8CustomXPathNSResolver::create(value->ToObject(isolate), iso
late); |
| 705 return resolver; | 705 return resolver; |
| 706 } | 706 } |
| 707 | 707 |
| 708 DOMWindow* toDOMWindow(v8::Handle<v8::Value> value, v8::Isolate* isolate) | 708 DOMWindow* toDOMWindow(v8::Isolate* isolate, v8::Handle<v8::Value> value) |
| 709 { | 709 { |
| 710 if (value.IsEmpty() || !value->IsObject()) | 710 if (value.IsEmpty() || !value->IsObject()) |
| 711 return 0; | 711 return 0; |
| 712 | 712 |
| 713 v8::Handle<v8::Object> windowWrapper = V8Window::findInstanceInPrototypeChai
n(v8::Handle<v8::Object>::Cast(value), isolate); | 713 v8::Handle<v8::Object> windowWrapper = V8Window::findInstanceInPrototypeChai
n(v8::Handle<v8::Object>::Cast(value), isolate); |
| 714 if (!windowWrapper.IsEmpty()) | 714 if (!windowWrapper.IsEmpty()) |
| 715 return V8Window::toImpl(windowWrapper); | 715 return V8Window::toImpl(windowWrapper); |
| 716 return 0; | 716 return 0; |
| 717 } | 717 } |
| 718 | 718 |
| 719 DOMWindow* toDOMWindow(v8::Handle<v8::Context> context) | 719 DOMWindow* toDOMWindow(v8::Handle<v8::Context> context) |
| 720 { | 720 { |
| 721 if (context.IsEmpty()) | 721 if (context.IsEmpty()) |
| 722 return 0; | 722 return 0; |
| 723 return toDOMWindow(context->Global(), context->GetIsolate()); | 723 return toDOMWindow(context->GetIsolate(), context->Global()); |
| 724 } | 724 } |
| 725 | 725 |
| 726 LocalDOMWindow* enteredDOMWindow(v8::Isolate* isolate) | 726 LocalDOMWindow* enteredDOMWindow(v8::Isolate* isolate) |
| 727 { | 727 { |
| 728 LocalDOMWindow* window = toLocalDOMWindow(toDOMWindow(isolate->GetEnteredCon
text())); | 728 LocalDOMWindow* window = toLocalDOMWindow(toDOMWindow(isolate->GetEnteredCon
text())); |
| 729 if (!window) { | 729 if (!window) { |
| 730 // We don't always have an entered DOM window, for example during microt
ask callbacks from V8 | 730 // We don't always have an entered DOM window, for example during microt
ask callbacks from V8 |
| 731 // (where the entered context may be the DOM-in-JS context). In that cas
e, we fall back | 731 // (where the entered context may be the DOM-in-JS context). In that cas
e, we fall back |
| 732 // to the current context. | 732 // to the current context. |
| 733 window = currentDOMWindow(isolate); | 733 window = currentDOMWindow(isolate); |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1003 | 1003 |
| 1004 v8::Local<v8::Value> v8IteratorResult(v8::Isolate* isolate, v8::Handle<v8::Value
> value) | 1004 v8::Local<v8::Value> v8IteratorResult(v8::Isolate* isolate, v8::Handle<v8::Value
> value) |
| 1005 { | 1005 { |
| 1006 v8::Local<v8::Object> result = v8::Object::New(isolate); | 1006 v8::Local<v8::Object> result = v8::Object::New(isolate); |
| 1007 result->Set(v8String(isolate, "value"), value); | 1007 result->Set(v8String(isolate, "value"), value); |
| 1008 result->Set(v8String(isolate, "done"), v8Boolean(false, isolate)); | 1008 result->Set(v8String(isolate, "done"), v8Boolean(false, isolate)); |
| 1009 return result; | 1009 return result; |
| 1010 } | 1010 } |
| 1011 | 1011 |
| 1012 } // namespace blink | 1012 } // namespace blink |
| OLD | NEW |