本文整理汇总了C++中JSDOMWindow类的典型用法代码示例。如果您正苦于以下问题:C++ JSDOMWindow类的具体用法?C++ JSDOMWindow怎么用?C++ JSDOMWindow使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JSDOMWindow类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: deletePropertyByIndex
bool JSDOMWindow::deletePropertyByIndex(JSCell* cell, ExecState* exec, unsigned propertyName)
{
JSDOMWindow* thisObject = jsCast<JSDOMWindow*>(cell);
// Only allow deleting properties by frames in the same origin.
if (!BindingSecurity::shouldAllowAccessToDOMWindow(exec, thisObject->wrapped(), ThrowSecurityError))
return false;
return Base::deletePropertyByIndex(thisObject, exec, propertyName);
}
示例2: lock
bool InjectedScriptHost::canAccessInspectedWindow(ScriptState* scriptState)
{
JSLock lock(SilenceAssertionsOnly);
JSDOMWindow* inspectedWindow = toJSDOMWindow(scriptState->lexicalGlobalObject());
if (!inspectedWindow)
return false;
return inspectedWindow->allowsAccessFromNoErrorMessage(scriptState);
}
示例3: toPage
static Page* toPage(JSGlobalObject* globalObject)
{
ASSERT_ARG(globalObject, globalObject);
JSDOMWindow* window = asJSDOMWindow(globalObject);
Frame* frame = window->impl()->frame();
return frame ? frame->page() : 0;
}
示例4: jsWrapperForWorld
JSValueRef WebFrame::jsWrapperForWorld(InjectedBundleRangeHandle* rangeHandle, InjectedBundleScriptWorld* world)
{
JSDOMWindow* globalObject = m_coreFrame->script()->globalObject(world->coreWorld());
ExecState* exec = globalObject->globalExec();
JSLock lock(SilenceAssertionsOnly);
return toRef(exec, toJS(exec, globalObject, rangeHandle->coreRange()));
}
示例5: deleteProperty
bool JSDOMWindow::deleteProperty(JSCell* cell, ExecState* exec, PropertyName propertyName)
{
JSDOMWindow* thisObject = jsCast<JSDOMWindow*>(cell);
// Only allow deleting properties by frames in the same origin.
if (!BindingSecurity::shouldAllowAccessToDOMWindow(exec, thisObject->impl()))
return false;
return Base::deleteProperty(thisObject, exec, propertyName);
}
示例6: getEnumerableLength
uint32_t JSDOMWindow::getEnumerableLength(ExecState* exec, JSObject* object)
{
JSDOMWindow* thisObject = jsCast<JSDOMWindow*>(object);
// Only allow the window to enumerated by frames in the same origin.
if (!BindingSecurity::shouldAllowAccessToDOMWindow(exec, thisObject->wrapped()))
return 0;
return Base::getEnumerableLength(exec, thisObject);
}
示例7: getStructurePropertyNames
void JSDOMWindow::getStructurePropertyNames(JSObject* object, ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)
{
JSDOMWindow* thisObject = jsCast<JSDOMWindow*>(object);
// Only allow the window to enumerated by frames in the same origin.
if (!BindingSecurity::shouldAllowAccessToDOMWindow(exec, thisObject->wrapped()))
return;
Base::getStructurePropertyNames(thisObject, exec, propertyNames, mode);
}
示例8: toJSDOMWindow
inline void DialogHandler::dialogCreated(DOMWindow* dialog)
{
m_frame = dialog->frame();
// FIXME: This looks like a leak between the normal world and an isolated
// world if dialogArguments comes from an isolated world.
JSDOMWindow* globalObject = toJSDOMWindow(m_frame.get(), normalWorld(m_exec->globalData()));
if (JSValue dialogArguments = m_exec->argument(1))
globalObject->putDirect(m_exec->globalData(), Identifier(m_exec, "dialogArguments"), dialogArguments);
}
示例9: lock
bool InspectorController::canAccessInspectedScriptState(JSC::ExecState* scriptState) const
{
JSLockHolder lock(scriptState);
JSDOMWindow* inspectedWindow = toJSDOMWindow(scriptState->lexicalGlobalObject());
if (!inspectedWindow)
return false;
return BindingSecurity::shouldAllowAccessToDOMWindow(scriptState, inspectedWindow->wrapped(), DoNotReportSecurityError);
}
示例10: getOwnPropertyNames
void JSDOMWindow::getOwnPropertyNames(JSObject* object, ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)
{
JSDOMWindow* thisObject = jsCast<JSDOMWindow*>(object);
if (!BindingSecurity::shouldAllowAccessToDOMWindow(exec, thisObject->wrapped(), DoNotReportSecurityError)) {
if (mode.includeDontEnumProperties())
addCrossOriginWindowPropertyNames(*exec, propertyNames);
return;
}
Base::getOwnPropertyNames(thisObject, exec, propertyNames, mode);
}
示例11: attachDebugger
void ScriptController::attachDebugger(JSDOMWindowShell* shell, JSC::Debugger* debugger)
{
if (!shell)
return;
JSDOMWindow* globalObject = shell->window();
if (debugger)
debugger->attach(globalObject);
else if (JSC::Debugger* currentDebugger = globalObject->debugger())
currentDebugger->detach(globalObject);
}
示例12: jsWrapperForWorld
JSValueRef WebFrame::jsWrapperForWorld(InjectedBundleRangeHandle* rangeHandle, InjectedBundleScriptWorld* world)
{
if (!m_coreFrame)
return 0;
JSDOMWindow* globalObject = m_coreFrame->script().globalObject(world->coreWorld());
ExecState* exec = globalObject->globalExec();
JSLockHolder lock(exec);
return toRef(exec, toJS(exec, globalObject, rangeHandle->coreRange()));
}
示例13: attachDebugger
void ScriptController::attachDebugger(JSDOMWindowShell* shell, JSC::Debugger* debugger)
{
if (!shell)
return;
JSDOMWindow* globalObject = shell->window();
JSLockHolder lock(globalObject->vm());
if (debugger)
debugger->attach(globalObject);
else if (JSC::Debugger* currentDebugger = globalObject->debugger())
currentDebugger->detach(globalObject, JSC::Debugger::TerminatingDebuggingSession);
}
示例14: visitChildren
void JSDOMWindow::visitChildren(JSCell* cell, SlotVisitor& visitor)
{
JSDOMWindow* thisObject = jsCast<JSDOMWindow*>(cell);
ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
COMPILE_ASSERT(StructureFlags & OverridesVisitChildren, OverridesVisitChildrenWithoutSettingFlag);
ASSERT(thisObject->structure()->typeInfo().overridesVisitChildren());
Base::visitChildren(thisObject, visitor);
thisObject->impl()->visitJSEventListeners(visitor);
if (Frame* frame = thisObject->impl()->frame())
visitor.addOpaqueRoot(frame);
}
示例15: parseCode
void JSLazyEventListener::parseCode() const
{
if (m_parsed)
return;
if (m_globalObject->scriptExecutionContext()->isDocument()) {
JSDOMWindow* window = static_cast<JSDOMWindow*>(m_globalObject);
Frame* frame = window->impl()->frame();
if (!frame)
return;
// FIXME: Is this check needed for non-Document contexts?
ScriptController* script = frame->script();
if (!script->isEnabled() || script->isPaused())
return;
}
m_parsed = true;
ExecState* exec = m_globalObject->globalExec();
MarkedArgumentBuffer args;
UString sourceURL(m_globalObject->scriptExecutionContext()->url().string());
args.append(jsNontrivialString(exec, m_eventParameterName));
args.append(jsString(exec, m_code));
// FIXME: Passing the document's URL to construct is not always correct, since this event listener might
// have been added with setAttribute from a script, and we should pass String() in that case.
m_jsFunction = constructFunction(exec, args, Identifier(exec, m_functionName), sourceURL, m_lineNumber); // FIXME: is globalExec ok?
JSFunction* listenerAsFunction = static_cast<JSFunction*>(m_jsFunction);
if (exec->hadException()) {
exec->clearException();
// failed to parse, so let's just make this listener a no-op
m_jsFunction = 0;
} else if (m_originalNode) {
// Add the event's home element to the scope
// (and the document, and the form - see JSHTMLElement::eventHandlerScope)
ScopeChain scope = listenerAsFunction->scope();
JSValue thisObj = toJS(exec, m_originalNode);
if (thisObj.isObject()) {
static_cast<JSNode*>(asObject(thisObj))->pushEventHandlerScope(exec, scope);
listenerAsFunction->setScope(scope);
}
}
// Since we only parse once, there's no need to keep data used for parsing around anymore.
m_functionName = String();
m_code = String();
m_eventParameterName = String();
}