本文整理汇总了C++中JSDOMWindow::allowsAccessFromNoErrorMessage方法的典型用法代码示例。如果您正苦于以下问题:C++ JSDOMWindow::allowsAccessFromNoErrorMessage方法的具体用法?C++ JSDOMWindow::allowsAccessFromNoErrorMessage怎么用?C++ JSDOMWindow::allowsAccessFromNoErrorMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JSDOMWindow
的用法示例。
在下文中一共展示了JSDOMWindow::allowsAccessFromNoErrorMessage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: canAccessInspectedWindow
bool InjectedScriptHost::canAccessInspectedWindow(ScriptState* scriptState)
{
JSLock lock(SilenceAssertionsOnly);
JSDOMWindow* inspectedWindow = toJSDOMWindow(scriptState->lexicalGlobalObject());
if (!inspectedWindow)
return false;
return inspectedWindow->allowsAccessFromNoErrorMessage(scriptState);
}
示例2: showModalDialog
JSValue JSDOMWindow::showModalDialog(ExecState* exec)
{
String url = valueToStringWithUndefinedOrNullCheck(exec, exec->argument(0));
JSValue dialogArgs = exec->argument(1);
String featureArgs = valueToStringWithUndefinedOrNullCheck(exec, exec->argument(2));
Frame* frame = impl()->frame();
if (!frame)
return jsUndefined();
Frame* lexicalFrame = toLexicalFrame(exec);
if (!lexicalFrame)
return jsUndefined();
Frame* dynamicFrame = toDynamicFrame(exec);
if (!dynamicFrame)
return jsUndefined();
if (!DOMWindow::canShowModalDialogNow(frame) || !domWindowAllowPopUp(dynamicFrame))
return jsUndefined();
HashMap<String, String> features;
DOMWindow::parseModalDialogFeatures(featureArgs, features);
const bool trusted = false;
// The following features from Microsoft's documentation are not implemented:
// - default font settings
// - width, height, left, and top specified in units other than "px"
// - edge (sunken or raised, default is raised)
// - dialogHide: trusted && boolFeature(features, "dialoghide"), makes dialog hide when you print
// - help: boolFeature(features, "help", true), makes help icon appear in dialog (what does it do on Windows?)
// - unadorned: trusted && boolFeature(features, "unadorned");
FloatRect screenRect = screenAvailableRect(frame->view());
WindowFeatures wargs;
wargs.width = WindowFeatures::floatFeature(features, "dialogwidth", 100, screenRect.width(), 620); // default here came from frame size of dialog in MacIE
wargs.widthSet = true;
wargs.height = WindowFeatures::floatFeature(features, "dialogheight", 100, screenRect.height(), 450); // default here came from frame size of dialog in MacIE
wargs.heightSet = true;
wargs.x = WindowFeatures::floatFeature(features, "dialogleft", screenRect.x(), screenRect.right() - wargs.width, -1);
wargs.xSet = wargs.x > 0;
wargs.y = WindowFeatures::floatFeature(features, "dialogtop", screenRect.y(), screenRect.bottom() - wargs.height, -1);
wargs.ySet = wargs.y > 0;
if (WindowFeatures::boolFeature(features, "center", true)) {
if (!wargs.xSet) {
wargs.x = screenRect.x() + (screenRect.width() - wargs.width) / 2;
wargs.xSet = true;
}
if (!wargs.ySet) {
wargs.y = screenRect.y() + (screenRect.height() - wargs.height) / 2;
wargs.ySet = true;
}
}
wargs.dialog = true;
wargs.resizable = WindowFeatures::boolFeature(features, "resizable");
wargs.scrollbarsVisible = WindowFeatures::boolFeature(features, "scroll", true);
wargs.statusBarVisible = WindowFeatures::boolFeature(features, "status", !trusted);
wargs.menuBarVisible = false;
wargs.toolBarVisible = false;
wargs.locationBarVisible = false;
wargs.fullscreen = false;
Frame* dialogFrame = createWindow(exec, lexicalFrame, dynamicFrame, frame, url, "", wargs, dialogArgs);
if (!dialogFrame)
return jsUndefined();
JSDOMWindow* dialogWindow = toJSDOMWindow(dialogFrame, currentWorld(exec));
dialogFrame->page()->chrome()->runModal();
Identifier returnValue(exec, "returnValue");
if (dialogWindow->allowsAccessFromNoErrorMessage(exec)) {
PropertySlot slot;
// This is safe, we have already performed the origin security check and we are
// not interested in any of the DOM properties of the window.
if (dialogWindow->JSGlobalObject::getOwnPropertySlot(exec, returnValue, slot))
return slot.getValue(exec, returnValue);
}
return jsUndefined();
}