OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010 Apple Inc. All rights reserv
ed. | 4 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010 Apple Inc. All rights reserv
ed. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
11 * This library is distributed in the hope that it will be useful, | 11 * This library is distributed in the hope that it will be useful, |
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 * Library General Public License for more details. | 14 * Library General Public License for more details. |
15 * | 15 * |
16 * You should have received a copy of the GNU Library General Public License | 16 * You should have received a copy of the GNU Library General Public License |
17 * along with this library; see the file COPYING.LIB. If not, write to | 17 * along with this library; see the file COPYING.LIB. If not, write to |
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
19 * Boston, MA 02110-1301, USA. | 19 * Boston, MA 02110-1301, USA. |
20 */ | 20 */ |
21 | 21 |
22 #include "config.h" | 22 #include "config.h" |
23 #include "core/loader/ImageLoader.h" | 23 #include "core/loader/ImageLoader.h" |
24 | 24 |
25 #include "bindings/core/v8/ScriptController.h" | 25 #include "bindings/core/v8/ScriptController.h" |
| 26 #include "bindings/core/v8/ScriptState.h" |
| 27 #include "bindings/core/v8/V8Binding.h" |
26 #include "core/dom/Document.h" | 28 #include "core/dom/Document.h" |
27 #include "core/dom/Element.h" | 29 #include "core/dom/Element.h" |
28 #include "core/dom/IncrementLoadEventDelayCount.h" | 30 #include "core/dom/IncrementLoadEventDelayCount.h" |
29 #include "core/dom/Microtask.h" | 31 #include "core/dom/Microtask.h" |
30 #include "core/events/Event.h" | 32 #include "core/events/Event.h" |
31 #include "core/events/EventSender.h" | 33 #include "core/events/EventSender.h" |
32 #include "core/fetch/FetchRequest.h" | 34 #include "core/fetch/FetchRequest.h" |
33 #include "core/fetch/MemoryCache.h" | 35 #include "core/fetch/MemoryCache.h" |
34 #include "core/fetch/ResourceFetcher.h" | 36 #include "core/fetch/ResourceFetcher.h" |
35 #include "core/frame/LocalFrame.h" | 37 #include "core/frame/LocalFrame.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 : m_loader(loader) | 85 : m_loader(loader) |
84 , m_shouldBypassMainWorldCSP(shouldBypassMainWorldCSP(loader)) | 86 , m_shouldBypassMainWorldCSP(shouldBypassMainWorldCSP(loader)) |
85 , m_updateBehavior(updateBehavior) | 87 , m_updateBehavior(updateBehavior) |
86 , m_weakFactory(this) | 88 , m_weakFactory(this) |
87 { | 89 { |
88 } | 90 } |
89 | 91 |
90 virtual void run() override | 92 virtual void run() override |
91 { | 93 { |
92 if (m_loader) { | 94 if (m_loader) { |
| 95 v8::Local<v8::Context> context = toV8Context(&m_loader->element()->d
ocument(), DOMWrapperWorld::mainWorld()); |
| 96 if (context.IsEmpty()) |
| 97 return; |
| 98 |
| 99 ScriptState::Scope scope(ScriptState::from(context)); |
93 #if ENABLE(OILPAN) | 100 #if ENABLE(OILPAN) |
94 // Oilpan: this WebThread::Task microtask may run after the | 101 // Oilpan: this WebThread::Task microtask may run after the |
95 // loader has been GCed, but not yet lazily swept & finalized | 102 // loader has been GCed, but not yet lazily swept & finalized |
96 // (when this task's loader reference will be cleared.) | 103 // (when this task's loader reference will be cleared.) |
97 // | 104 // |
98 // Handle this transient condition by explicitly checking here | 105 // Handle this transient condition by explicitly checking here |
99 // before going ahead with the update operation. Unsafe to do it | 106 // before going ahead with the update operation. Unsafe to do it |
100 // if so, as the objects that the loader refers to may have been | 107 // if so, as the objects that the loader refers to may have been |
101 // finalized by this time. | 108 // finalized by this time. |
102 if (Heap::willObjectBeLazilySwept(m_loader)) | 109 if (Heap::willObjectBeLazilySwept(m_loader)) |
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
622 #endif | 629 #endif |
623 } | 630 } |
624 | 631 |
625 #if ENABLE(OILPAN) | 632 #if ENABLE(OILPAN) |
626 ImageLoader::ImageLoaderClientRemover::~ImageLoaderClientRemover() | 633 ImageLoader::ImageLoaderClientRemover::~ImageLoaderClientRemover() |
627 { | 634 { |
628 m_loader.willRemoveClient(m_client); | 635 m_loader.willRemoveClient(m_client); |
629 } | 636 } |
630 #endif | 637 #endif |
631 } | 638 } |
OLD | NEW |