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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 #include "bindings/v8/V8NodeFilterCondition.h" | 42 #include "bindings/v8/V8NodeFilterCondition.h" |
43 #include "bindings/v8/V8ObjectConstructor.h" | 43 #include "bindings/v8/V8ObjectConstructor.h" |
44 #include "bindings/v8/V8WindowShell.h" | 44 #include "bindings/v8/V8WindowShell.h" |
45 #include "bindings/v8/WorkerScriptController.h" | 45 #include "bindings/v8/WorkerScriptController.h" |
46 #include "bindings/v8/custom/V8CustomXPathNSResolver.h" | 46 #include "bindings/v8/custom/V8CustomXPathNSResolver.h" |
47 #include "core/dom/Element.h" | 47 #include "core/dom/Element.h" |
48 #include "core/dom/NodeFilter.h" | 48 #include "core/dom/NodeFilter.h" |
49 #include "core/dom/QualifiedName.h" | 49 #include "core/dom/QualifiedName.h" |
50 #include "core/frame/LocalFrame.h" | 50 #include "core/frame/LocalFrame.h" |
51 #include "core/frame/Settings.h" | 51 #include "core/frame/Settings.h" |
52 #include "core/frame/UseCounter.h" | |
53 #include "core/inspector/BindingVisitors.h" | 52 #include "core/inspector/BindingVisitors.h" |
54 #include "core/loader/FrameLoader.h" | 53 #include "core/loader/FrameLoader.h" |
55 #include "core/loader/FrameLoaderClient.h" | 54 #include "core/loader/FrameLoaderClient.h" |
56 #include "core/workers/WorkerGlobalScope.h" | 55 #include "core/workers/WorkerGlobalScope.h" |
57 #include "core/xml/XPathNSResolver.h" | 56 #include "core/xml/XPathNSResolver.h" |
58 #include "wtf/ArrayBufferContents.h" | 57 #include "wtf/ArrayBufferContents.h" |
59 #include "wtf/MainThread.h" | 58 #include "wtf/MainThread.h" |
60 #include "wtf/MathExtras.h" | 59 #include "wtf/MathExtras.h" |
61 #include "wtf/StdLibExtras.h" | 60 #include "wtf/StdLibExtras.h" |
62 #include "wtf/Threading.h" | 61 #include "wtf/Threading.h" |
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
567 { | 566 { |
568 if (!frame) | 567 if (!frame) |
569 return v8::Local<v8::Context>(); | 568 return v8::Local<v8::Context>(); |
570 v8::Local<v8::Context> context = frame->script().windowShell(world)->context
(); | 569 v8::Local<v8::Context> context = frame->script().windowShell(world)->context
(); |
571 if (context.IsEmpty()) | 570 if (context.IsEmpty()) |
572 return v8::Local<v8::Context>(); | 571 return v8::Local<v8::Context>(); |
573 LocalFrame* attachedFrame= toFrameIfNotDetached(context); | 572 LocalFrame* attachedFrame= toFrameIfNotDetached(context); |
574 return frame == attachedFrame ? context : v8::Local<v8::Context>(); | 573 return frame == attachedFrame ? context : v8::Local<v8::Context>(); |
575 } | 574 } |
576 | 575 |
577 bool handleOutOfMemory() | |
578 { | |
579 v8::Local<v8::Context> context = v8::Isolate::GetCurrent()->GetCurrentContex
t(); | |
580 | |
581 if (!context->HasOutOfMemoryException()) | |
582 return false; | |
583 | |
584 // Warning, error, disable JS for this frame? | |
585 LocalFrame* frame = toFrameIfNotDetached(context); | |
586 if (!frame) | |
587 return true; | |
588 | |
589 frame->script().clearForOutOfMemory(); | |
590 frame->loader().client()->didExhaustMemoryAvailableForScript(); | |
591 UseCounter::count(frame->document(), UseCounter::JavascriptExhaustedMemory); | |
592 | |
593 if (Settings* settings = frame->settings()) | |
594 settings->setScriptEnabled(false); | |
595 | |
596 return true; | |
597 } | |
598 | |
599 v8::Local<v8::Value> handleMaxRecursionDepthExceeded(v8::Isolate* isolate) | 576 v8::Local<v8::Value> handleMaxRecursionDepthExceeded(v8::Isolate* isolate) |
600 { | 577 { |
601 throwError(v8RangeError, "Maximum call stack size exceeded.", isolate); | 578 throwError(v8RangeError, "Maximum call stack size exceeded.", isolate); |
602 return v8::Local<v8::Value>(); | 579 return v8::Local<v8::Value>(); |
603 } | 580 } |
604 | 581 |
605 void crashIfV8IsDead() | 582 void crashIfV8IsDead() |
606 { | 583 { |
607 if (v8::V8::IsDead()) { | 584 if (v8::V8::IsDead()) { |
608 // FIXME: We temporarily deal with V8 internal error situations | 585 // FIXME: We temporarily deal with V8 internal error situations |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
699 V8BindingTestScope::V8BindingTestScope(v8::Isolate* isolate) | 676 V8BindingTestScope::V8BindingTestScope(v8::Isolate* isolate) |
700 : m_handleScope(isolate) | 677 : m_handleScope(isolate) |
701 , m_context(v8::Context::New(isolate)) | 678 , m_context(v8::Context::New(isolate)) |
702 , m_contextScope(m_context) | 679 , m_contextScope(m_context) |
703 , m_world(DOMWrapperWorld::create()) | 680 , m_world(DOMWrapperWorld::create()) |
704 , m_perContextData(V8PerContextData::create(m_context, m_world)) | 681 , m_perContextData(V8PerContextData::create(m_context, m_world)) |
705 { | 682 { |
706 } | 683 } |
707 | 684 |
708 } // namespace WebCore | 685 } // namespace WebCore |
OLD | NEW |