| 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" | |
| 28 #include "core/dom/Document.h" | 26 #include "core/dom/Document.h" |
| 29 #include "core/dom/Element.h" | 27 #include "core/dom/Element.h" |
| 30 #include "core/dom/IncrementLoadEventDelayCount.h" | 28 #include "core/dom/IncrementLoadEventDelayCount.h" |
| 31 #include "core/dom/Microtask.h" | 29 #include "core/dom/Microtask.h" |
| 32 #include "core/events/Event.h" | 30 #include "core/events/Event.h" |
| 33 #include "core/events/EventSender.h" | 31 #include "core/events/EventSender.h" |
| 34 #include "core/fetch/FetchRequest.h" | 32 #include "core/fetch/FetchRequest.h" |
| 35 #include "core/fetch/MemoryCache.h" | 33 #include "core/fetch/MemoryCache.h" |
| 36 #include "core/fetch/ResourceFetcher.h" | 34 #include "core/fetch/ResourceFetcher.h" |
| 37 #include "core/frame/LocalFrame.h" | 35 #include "core/frame/LocalFrame.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 : m_loader(loader) | 83 : m_loader(loader) |
| 86 , m_shouldBypassMainWorldCSP(shouldBypassMainWorldCSP(loader)) | 84 , m_shouldBypassMainWorldCSP(shouldBypassMainWorldCSP(loader)) |
| 87 , m_updateBehavior(updateBehavior) | 85 , m_updateBehavior(updateBehavior) |
| 88 , m_weakFactory(this) | 86 , m_weakFactory(this) |
| 89 { | 87 { |
| 90 } | 88 } |
| 91 | 89 |
| 92 virtual void run() override | 90 virtual void run() override |
| 93 { | 91 { |
| 94 if (m_loader) { | 92 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)); | |
| 100 #if ENABLE(OILPAN) | 93 #if ENABLE(OILPAN) |
| 101 // Oilpan: this WebThread::Task microtask may run after the | 94 // Oilpan: this WebThread::Task microtask may run after the |
| 102 // loader has been GCed, but not yet lazily swept & finalized | 95 // loader has been GCed, but not yet lazily swept & finalized |
| 103 // (when this task's loader reference will be cleared.) | 96 // (when this task's loader reference will be cleared.) |
| 104 // | 97 // |
| 105 // Handle this transient condition by explicitly checking here | 98 // Handle this transient condition by explicitly checking here |
| 106 // before going ahead with the update operation. Unsafe to do it | 99 // before going ahead with the update operation. Unsafe to do it |
| 107 // if so, as the objects that the loader refers to may have been | 100 // if so, as the objects that the loader refers to may have been |
| 108 // finalized by this time. | 101 // finalized by this time. |
| 109 if (Heap::willObjectBeLazilySwept(m_loader)) | 102 if (Heap::willObjectBeLazilySwept(m_loader)) |
| (...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 629 #endif | 622 #endif |
| 630 } | 623 } |
| 631 | 624 |
| 632 #if ENABLE(OILPAN) | 625 #if ENABLE(OILPAN) |
| 633 ImageLoader::ImageLoaderClientRemover::~ImageLoaderClientRemover() | 626 ImageLoader::ImageLoaderClientRemover::~ImageLoaderClientRemover() |
| 634 { | 627 { |
| 635 m_loader.willRemoveClient(m_client); | 628 m_loader.willRemoveClient(m_client); |
| 636 } | 629 } |
| 637 #endif | 630 #endif |
| 638 } | 631 } |
| OLD | NEW |