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 752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
763 if (!workletWrapper.IsEmpty()) | 763 if (!workletWrapper.IsEmpty()) |
764 return V8WorkletGlobalScope::toImpl(workletWrapper); | 764 return V8WorkletGlobalScope::toImpl(workletWrapper); |
765 // FIXME: Is this line of code reachable? | 765 // FIXME: Is this line of code reachable? |
766 return nullptr; | 766 return nullptr; |
767 } | 767 } |
768 | 768 |
769 ExecutionContext* currentExecutionContext(v8::Isolate* isolate) { | 769 ExecutionContext* currentExecutionContext(v8::Isolate* isolate) { |
770 return toExecutionContext(isolate->GetCurrentContext()); | 770 return toExecutionContext(isolate->GetCurrentContext()); |
771 } | 771 } |
772 | 772 |
773 ExecutionContext* enteredExecutionContext(v8::Isolate* isolate) { | |
774 ExecutionContext* context = toExecutionContext(isolate->GetEnteredContext()); | |
775 if (!context) { | |
776 // We don't always have an entered execution context, for example during | |
777 // microtask callbacks from V8 (where the entered context may be the | |
778 // DOM-in-JS context). In that case, we fall back to the current context. | |
779 context = currentExecutionContext(isolate); | |
780 ASSERT(context); | |
781 } | |
782 return context; | |
783 } | |
784 | |
falken
2017/02/24 06:49:27
Thanks for deleting this.
| |
785 Frame* toFrameIfNotDetached(v8::Local<v8::Context> context) { | 773 Frame* toFrameIfNotDetached(v8::Local<v8::Context> context) { |
786 DOMWindow* window = toDOMWindow(context); | 774 DOMWindow* window = toDOMWindow(context); |
787 if (window && window->isCurrentlyDisplayedInFrame()) | 775 if (window && window->isCurrentlyDisplayedInFrame()) |
788 return window->frame(); | 776 return window->frame(); |
789 // We return 0 here because |context| is detached from the Frame. If we | 777 // We return 0 here because |context| is detached from the Frame. If we |
790 // did return |frame| we could get in trouble because the frame could be | 778 // did return |frame| we could get in trouble because the frame could be |
791 // navigated to another security origin. | 779 // navigated to another security origin. |
792 return nullptr; | 780 return nullptr; |
793 } | 781 } |
794 | 782 |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1001 if (!v8Call(v8::JSON::Parse(isolate, v8String(isolate, stringifiedJSON)), | 989 if (!v8Call(v8::JSON::Parse(isolate, v8String(isolate, stringifiedJSON)), |
1002 parsed, tryCatch)) { | 990 parsed, tryCatch)) { |
1003 if (tryCatch.HasCaught()) | 991 if (tryCatch.HasCaught()) |
1004 exceptionState.rethrowV8Exception(tryCatch.Exception()); | 992 exceptionState.rethrowV8Exception(tryCatch.Exception()); |
1005 } | 993 } |
1006 | 994 |
1007 return parsed; | 995 return parsed; |
1008 } | 996 } |
1009 | 997 |
1010 } // namespace blink | 998 } // namespace blink |
OLD | NEW |