void JSNPObject::put(JSCell* cell, ExecState* exec, PropertyName propertyName, JSValue value, PutPropertySlot&) { JSNPObject* thisObject = JSC::jsCast<JSNPObject*>(cell); ASSERT_GC_OBJECT_INHERITS(thisObject, info()); if (!thisObject->m_npObject) { throwInvalidAccessError(exec); return; } NPIdentifier npIdentifier = npIdentifierFromIdentifier(propertyName); if (!thisObject->m_npObject->_class->hasProperty || !thisObject->m_npObject->_class->hasProperty(thisObject->m_npObject, npIdentifier)) { // FIXME: Should we throw an exception here? return; } if (!thisObject->m_npObject->_class->setProperty) return; NPVariant variant; thisObject->m_objectMap->convertJSValueToNPVariant(exec, value, variant); // Calling NPClass::setProperty will call into plug-in code, and there's no telling what the plug-in can do. // (including destroying the plug-in). Because of this, we make sure to keep the plug-in alive until // the call has finished. NPRuntimeObjectMap::PluginProtector protector(thisObject->m_objectMap); { JSLock::DropAllLocks dropAllLocks(JSDOMWindowBase::commonVM()); thisObject->m_npObject->_class->setProperty(thisObject->m_npObject, npIdentifier, &variant); NPRuntimeObjectMap::moveGlobalExceptionToExecState(exec); // FIXME: Should we throw an exception if setProperty returns false? } releaseNPVariantValue(&variant); }
void JSNPObject::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot&) { if (!m_npObject) { throwInvalidAccessError(exec); return; } NPIdentifier npIdentifier = npIdentifierFromIdentifier(propertyName); if (!m_npObject->_class->hasProperty || !m_npObject->_class->hasProperty(m_npObject, npIdentifier)) { // FIXME: Should we throw an exception here? return; } if (!m_npObject->_class->setProperty) return; NPVariant variant; m_objectMap->convertJSValueToNPVariant(exec, value, variant); // Calling NPClass::setProperty will call into plug-in code, and there's no telling what the plug-in can do. // (including destroying the plug-in). Because of this, we make sure to keep the plug-in alive until // the call has finished. NPRuntimeObjectMap::PluginProtector protector(m_objectMap); { JSLock::DropAllLocks dropAllLocks(SilenceAssertionsOnly); m_npObject->_class->setProperty(m_npObject, npIdentifier, &variant); NPRuntimeObjectMap::moveGlobalExceptionToExecState(exec); // FIXME: Should we throw an exception if setProperty returns false? } releaseNPVariantValue(&variant); }
void PluginView::setNPWindowIfNeeded() { if (!m_isStarted || !parent() || !m_plugin->pluginFuncs()->setwindow) return; // If the plugin didn't load sucessfully, no point in calling setwindow if (m_status != PluginStatusLoadedSuccessfully) return; // On Unix, only call plugin's setwindow if it's full-page or windowed if (m_mode != NP_FULL && m_mode != NP_EMBED) return; // Check if the platformPluginWidget still exists if (m_isWindowed && !platformPluginWidget()) return; if (m_clipRect.isEmpty()) { // If width or height are null, set the clipRect to null, // indicating that the plugin is not visible/scrolled out. m_npWindow.clipRect.left = 0; m_npWindow.clipRect.right = 0; m_npWindow.clipRect.top = 0; m_npWindow.clipRect.bottom = 0; } else { // Clipping rectangle of the plug-in; the origin is the top left corner of the drawable or window. m_npWindow.clipRect.left = m_npWindow.x + m_clipRect.x(); m_npWindow.clipRect.top = m_npWindow.y + m_clipRect.y(); m_npWindow.clipRect.right = m_npWindow.x + m_clipRect.x() + m_clipRect.width(); m_npWindow.clipRect.bottom = m_npWindow.y + m_clipRect.y() + m_clipRect.height(); } // FLASH WORKAROUND: Only set initially. Multiple calls to // setNPWindow() cause the plugin to crash in windowed mode. if (!m_plugin->quirks().contains(PluginQuirkDontCallSetWindowMoreThanOnce) || !m_isWindowed || m_npWindow.width == static_cast<uint32_t>(-1) || m_npWindow.height == static_cast<uint32_t>(-1)) { m_npWindow.width = m_windowRect.width(); m_npWindow.height = m_windowRect.height(); } PluginView::setCurrentPluginView(this); JSC::JSLock::DropAllLocks dropAllLocks(JSDOMWindowBase::commonVM()); setCallingPlugin(true); m_plugin->pluginFuncs()->setwindow(m_instance, &m_npWindow); setCallingPlugin(false); PluginView::setCurrentPluginView(0); if (!m_isWindowed) return; #if PLATFORM(GTK) // GtkXtBin will call gtk_widget_size_allocate, so we don't need to do it here. if (!m_needsXEmbed) { gtk_xtbin_set_position(GTK_XTBIN(platformPluginWidget()), m_windowRect.x(), m_windowRect.y()); gtk_xtbin_resize(platformPluginWidget(), m_windowRect.width(), m_windowRect.height()); return; } m_delayedAllocation = m_windowRect; updateWidgetAllocationAndClip(); #endif }
void JSGlobalObjectDebuggable::pauseWaitingForAutomaticInspection() { JSC::JSLock::DropAllLocks dropAllLocks(&m_globalObject.vm()); RemoteInspectionTarget::pauseWaitingForAutomaticInspection(); }