Reviewed by Darin, Sam, and Adam.
- <rdar://problem/
5654486> REGRESSION (Safari 3.0.4-TOT): clicking on
- link in gmail message displays JavaScript alert falsely complaining
about pop-up blocking
- When trying to open a new window, we now see if the user gesture
occurred in the global dynamic object instead of the frame since that is
the only place an event can occur.
* bindings/js/kjs_window.cpp: - Check the dynamic global object instead
of the frame.
(KJS::allowPopUp):
(KJS::showModalDialog):
(KJS::WindowProtoFuncOpen::callAsFunction):
WebKitTools:
Reviewed by Darin, Sam and Adam.
-<rdar://problem/
5654486> REGRESSION (Safari 3.0.4-TOT): clicking on
link in gmail message displays JavaScript alert falsely complaining
about pop-up blocking.
- Added the ability to enable the pop-up blocker via the
LayoutTestController.
* DumpRenderTree/LayoutTestController.cpp:
(setPopupBlockingEnabledCallback):
(LayoutTestController::staticFunctions):
* DumpRenderTree/LayoutTestController.h:
* DumpRenderTree/mac/DumpRenderTree.mm:
(setDefaultsToConsistentValuesForTesting):
(resetWebViewToConsistentStateBeforeTesting):
* DumpRenderTree/mac/LayoutTestControllerMac.mm:
(LayoutTestController::setPopupBlockingEnabled):
LayoutTests:
Reviewed by Darin, Sam, and Adam.
-<rdar://problem/
5654486> REGRESSION (Safari 3.0.4-TOT): clicking on
link in gmail message displays JavaScript alert falsely complaining
about pop-up blocking
- When trying to open a new window, we now see if the user gesture
occurred in the global dynamic object instead of the frame since that is
the only place an event can occur.
* fast/events/open-window-from-another-frame-expected.txt: Added.
* fast/events/open-window-from-another-frame.html: Added.
* fast/events/resources/open-window-from-another-frame-otherFrame.html: Added.
* fast/events/resources/window-opened.html: Added.
* platform/win/Skipped:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@29365
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2008-01-10 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Darin, Sam, and Adam.
+
+ -<rdar://problem/5654486> REGRESSION (Safari 3.0.4-TOT): clicking on
+ link in gmail message displays JavaScript alert falsely complaining
+ about pop-up blocking
+ - When trying to open a new window, we now see if the user gesture
+ occurred in the global dynamic object instead of the frame since that is
+ the only place an event can occur.
+
+ * fast/events/open-window-from-another-frame-expected.txt: Added.
+ * fast/events/open-window-from-another-frame.html: Added.
+ * fast/events/resources/open-window-from-another-frame-otherFrame.html: Added.
+ * fast/events/resources/window-opened.html: Added.
+ * platform/win/Skipped:
+
2008-01-10 Dan Bernstein <mitz@apple.com>
Reviewed by Darin Adler.
--- /dev/null
+This tests that window.open works across frames.
+To run manually click the link below.
+GreenBox or Success page.
+
+Window was opened! Test succeeded!
+
+
+--------
+Frame: 'otherFrame'
+--------
+This frame should handle the click event on the anchor element in the other window.
--- /dev/null
+<html>
+ <head>
+ <script>
+ if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ layoutTestController.setCanOpenWindows();
+ layoutTestController.dumpChildFramesAsText();
+ layoutTestController.waitUntilDone();
+ layoutTestController.setCloseRemainingWindowsWhenComplete()
+ layoutTestController.setPopupBlockingEnabled(true);
+ }
+
+ function test()
+ {
+ var myLink = document.getElementById('link');
+ var myFrame = document.getElementById('otherFrame').contentWindow;
+ myLink.onclick = myFrame.handleClick;
+ if (window.layoutTestController) {
+ var x = myLink.offsetLeft + 2;
+ var y = myLink.offsetTop + 2;
+ eventSender.mouseMoveTo(x, y);
+ eventSender.mouseDown();
+ eventSender.mouseUp();
+ }
+ }
+
+ function log(msg)
+ {
+ var res = document.getElementById('res');
+ res.innerHTML = res.innerHTML + msg + "<br>";
+ }
+ </script>
+ </head>
+ <body onload="test()">
+ This tests that window.open works across frames.<br>
+ To run manually click the link below.<br>
+ <a href="resources/greenbox.png" id="link">GreenBox or Success page.</a><br>
+ <iframe src="resources/open-window-from-another-frame-otherFrame.html" id="otherFrame"></iframe>
+ <div id="res"></div>
+ </body>
+</html>
--- /dev/null
+<body>
+ This frame should handle the click event on the anchor element in the other window.
+ <script>
+ function closeWin(winToClose) {
+ winToClose.close();
+ setTimeout(doneHandler, 1);
+
+ function doneHandler() {
+ if (!winToClose.closed)
+ setTimeout(doneHandler, 1);
+ else if (window.layoutTestController)
+ layoutTestController.notifyDone();
+ }
+ }
+
+ function handleClick(event) {
+ var newWin = window.open('resources/window-opened.html', 'badName', 'width=100, height=100');
+ if (newWin) {
+ parent.log("Window was opened! Test succeeded!");
+ closeWin(newWin);
+ }
+
+ event.preventDefault();
+ return false;
+ }
+ </script>
+</body>
--- /dev/null
+<body>
+ This window was opened! Test succeeded!
+</body>
\ No newline at end of file
fast/dom/open-and-close-by-DOM.html
fast/dom/Document/early-document-access.html
fast/events/attempt-scroll-with-no-scrollbars.html
+fast/events/open-window-from-another-frame.html
fast/history/history_reload.html
http/tests/navigation/new-window-redirect-history.html
http/tests/navigation/target-frame-from-window.html
+2008-01-10 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Darin, Sam, and Adam.
+
+ - <rdar://problem/5654486> REGRESSION (Safari 3.0.4-TOT): clicking on
+ - link in gmail message displays JavaScript alert falsely complaining
+ about pop-up blocking
+ - When trying to open a new window, we now see if the user gesture
+ occurred in the global dynamic object instead of the frame since that is
+ the only place an event can occur.
+
+ * bindings/js/kjs_window.cpp: - Check the dynamic global object instead
+ of the frame.
+ (KJS::allowPopUp):
+ (KJS::showModalDialog):
+ (KJS::WindowProtoFuncOpen::callAsFunction):
+
2008-01-10 David Hyatt <hyatt@apple.com>
Fix for bug 16247, visibility:hidden not honored when hit testing inline replaced elements.
d->loc->mark();
}
-static bool allowPopUp(Frame* frame)
+static bool allowPopUp(ExecState* exec)
{
- if (!frame)
- return false;
+ Frame* frame = Window::retrieveActive(exec)->impl()->frame();
+
+ ASSERT(frame);
if (frame->scriptProxy()->processingUserGesture())
return true;
Settings* settings = frame->settings();
static JSValue* showModalDialog(ExecState* exec, Frame* frame, const String& url, JSValue* dialogArgs, const String& featureArgs)
{
- if (!canShowModalDialogNow(frame) || !allowPopUp(frame))
+ if (!canShowModalDialogNow(frame) || !allowPopUp(exec))
return jsUndefined();
const HashMap<String, String> features = parseModalDialogFeatures(featureArgs);
// Because FrameTree::find() returns true for empty strings, we must check for empty framenames.
// Otherwise, illegitimate window.open() calls with no name will pass right through the popup blocker.
- if (!allowPopUp(frame) && (frameName.isEmpty() || !frame->tree()->find(frameName)))
+ if (!allowPopUp(exec) && (frameName.isEmpty() || !frame->tree()->find(frameName)))
return jsUndefined();
// Get the target frame for the special cases of _top and _parent. In those
+2008-01-09 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Darin, Sam and Adam.
+
+ -<rdar://problem/5654486> REGRESSION (Safari 3.0.4-TOT): clicking on
+ link in gmail message displays JavaScript alert falsely complaining
+ about pop-up blocking.
+ - Added the ability to enable the pop-up blocker via the
+ LayoutTestController.
+
+ * DumpRenderTree/LayoutTestController.cpp:
+ (setPopupBlockingEnabledCallback):
+ (LayoutTestController::staticFunctions):
+ * DumpRenderTree/LayoutTestController.h:
+ * DumpRenderTree/mac/DumpRenderTree.mm:
+ (setDefaultsToConsistentValuesForTesting):
+ (resetWebViewToConsistentStateBeforeTesting):
+ * DumpRenderTree/mac/LayoutTestControllerMac.mm:
+ (LayoutTestController::setPopupBlockingEnabled):
+
2008-01-10 Lars Knoll <lars@trolltech.com>
Reviewed by Simon.
return JSValueMakeNumber(context, windows);
}
+static JSValueRef setPopupBlockingEnabledCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ // Has mac & windows implementation
+ if (argumentCount < 1)
+ return JSValueMakeUndefined(context);
+
+ LayoutTestController* controller = reinterpret_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
+ controller->setPopupBlockingEnabled(JSValueToBoolean(context, arguments[0]));
+
+ return JSValueMakeUndefined(context);
+}
+
+
// Static Values
static JSValueRef getGlobalFlagCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
{ "setCustomPolicyDelegate", setCustomPolicyDelegateCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setMainFrameIsFirstResponder", setMainFrameIsFirstResponderCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setPrivateBrowsingEnabled", setPrivateBrowsingEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { "setPopupBlockingEnabled", setPopupBlockingEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setTabKeyCyclesThroughElements", setTabKeyCyclesThroughElementsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setUseDashboardCompatibilityMode", setUseDashboardCompatibilityModeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setUserStyleSheetEnabled", setUserStyleSheetEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
void setCustomPolicyDelegate(bool setDelegate);
void setMainFrameIsFirstResponder(bool flag);
void setPrivateBrowsingEnabled(bool flag);
+ void setPopupBlockingEnabled(bool flag);
void setTabKeyCyclesThroughElements(bool cycles);
void setUseDashboardCompatibilityMode(bool flag);
void setUserStyleSheetEnabled(bool flag);
bool globalFlag() const { return m_globalFlag; }
void setGlobalFlag(bool globalFlag) { m_globalFlag = globalFlag; }
-
+
private:
bool m_dumpAsText;
bool m_dumpBackForwardList;
// FIXME: implement
}
+void LayoutTestController::setPopupBlockingEnabled(bool popupBlockingEnabled)
+{
+ // FIXME: implement
+}
+
void LayoutTestController::execCommand(JSStringRef name, JSStringRef value)
{
// FIXME: implement
[preferences setDefaultFixedFontSize:13];
[preferences setMinimumFontSize:1];
[preferences setJavaEnabled:NO];
- [preferences setJavaScriptCanOpenWindowsAutomatically:YES];
[preferences setEditableLinkBehavior:WebKitEditableLinkOnlyLiveWithShiftKey];
[preferences setTabsToLinks:NO];
[preferences setDOMPasteAllowed:YES];
WebPreferences *preferences = [webView preferences];
[preferences setPrivateBrowsingEnabled:NO];
[preferences setAuthorAndUserStylesEnabled:YES];
+ [preferences setJavaScriptCanOpenWindowsAutomatically:YES];
[WebView _setUsesTestModeFocusRingColor:YES];
}
[[[mainFrame webView] preferences] setPrivateBrowsingEnabled:privateBrowsingEnabled];
}
+void LayoutTestController::setPopupBlockingEnabled(bool popupBlockingEnabled)
+{
+ [[[mainFrame webView] preferences] setJavaScriptCanOpenWindowsAutomatically:!popupBlockingEnabled];
+}
+
void LayoutTestController::setTabKeyCyclesThroughElements(bool cycles)
{
[[mainFrame webView] setTabKeyCyclesThroughElements:cycles];
preferences->setPrivateBrowsingEnabled(privateBrowsingEnabled);
}
+void LayoutTestController::setPopupBlockingEnabled(bool privateBrowsingEnabled)
+{
+ COMPtr<IWebView> webView;
+ if (FAILED(frame->webView(&webView)))
+ return;
+
+ COMPtr<IWebPreferences> preferences;
+ if (FAILED(webView->preferences(&preferences)))
+ return;
+
+ preferences->setJavaScriptCanOpenWindowsAutomatically(!privateBrowsingEnabled);
+}
+
void LayoutTestController::setTabKeyCyclesThroughElements(bool shouldCycle)
{
COMPtr<IWebView> webView;