You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ar...@apache.org on 2009/03/19 01:03:29 UTC
svn commit: r755794 - in
/myfaces/trinidad/trunk/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs:
Core.js Window.js
Author: arobinson74
Date: Thu Mar 19 00:03:29 2009
New Revision: 755794
URL: http://svn.apache.org/viewvc?rev=755794&view=rev
Log:
TRINIDAD-1431
When IE is set to force popups into tabs, several problem surrounding the setCapture calls caused IE to lock up and become unusable
Modified:
myfaces/trinidad/trunk/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Core.js
myfaces/trinidad/trunk/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Window.js
Modified: myfaces/trinidad/trunk/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Core.js
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Core.js?rev=755794&r1=755793&r2=755794&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Core.js (original)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Core.js Thu Mar 19 00:03:29 2009
@@ -220,7 +220,7 @@
var isSolaris = false;
var isWindows = false;
var isWindowsMobile6 = false;
- var isNokiaPhone = false;
+ var isNokiaPhone = false;
var kind = "unknown";
// Group IE and IE based browsers such as IE Mobile on WM5 and WM6
@@ -318,9 +318,9 @@
// BlackBerryXXXX/Y.Y.Y.Y is the BlackBerry user agent format
// XXXX is the model number and Y.Y.Y.Y is the OS version number.
- // At this moment, BlackBerry below version 4.6 is regarded as
+ // At this moment, BlackBerry below version 4.6 is regarded as
// basic HTML browser for the JS performance reason.
- // The following lines should be uncommented when we decide to
+ // The following lines should be uncommented when we decide to
// handle BlackBerry version 4.0~4.5 separate from the batch of
// Basic HTML browsers after its JS performance improves.
/*
@@ -336,7 +336,7 @@
supportsValidation = false;
}
*/
-
+
isBlackBerry = true;
kind = "blackberry";
}
@@ -369,11 +369,11 @@
isSolaris = true;
}
else if ((agentString.indexOf('symbian') != -1) ||
- (agentString.indexOf('nokia') != -1))
- {
+ (agentString.indexOf('nokia') != -1))
+ {
isNokiaPhone = true;
pprUnsupported = true;
- }
+ }
_agent.isBlackBerry = isBlackBerry;
_agent.isGecko = isGecko;
@@ -996,6 +996,8 @@
window._modalSavedListeners = savedListeners;
// Set the capture
+ window._trIeCapture = element;
+ window._trIeCaptureCurrent = true;
element.setCapture();
}
@@ -1023,14 +1025,30 @@
window._modalSavedListeners = null;
}
+ window._trIeCapture = undefined;
}
-
// Captures (and consumes) events during modal grabs
// on IE browsers
function _captureEventIE()
{
- window.event.cancelBubble = true;
+ // do not capture events outside the document body, this leads to the inability for users
+ // to click on IE toolbars, menubars, etc.
+ var event = window.event;
+ if (event.screenY >= window.screenTop && event.screenX >= window.screenLeft)
+ {
+ if (!window._trIeCaptureCurrent && window._trIeCapture)
+ {
+ window._trIeCaptureCurrent = true;
+ window._trIeCapture.setCapture();
+ }
+ event.cancelBubble = true;
+ }
+ else if (window._trIeCapture)
+ {
+ window._trIeCaptureCurrent = false;
+ window._trIeCapture.releaseCapture();
+ }
}
// Adds a (Gecko-specific) capture to the specified element
@@ -1249,7 +1267,7 @@
var funcName = '_' + _getJavascriptId(_getFormName(form)) + 'Validator';
var formWind = window[funcName];
- if (formWind)
+ if (formWind)
{
try
{
@@ -1271,7 +1289,7 @@
}
return ret;
}
-
+
return false;
}
@@ -1366,7 +1384,7 @@
// Get the current message
var facesMessage = messages[j];
-
+
if (_agent.isNokiaPhone)
{
errorString = _getGlobalErrorString(currInput,
@@ -1380,8 +1398,8 @@
globalMessage,
facesMessage.getDetail(),
label);
- }
-
+ }
+
failureString += errorString + '\n';
}
}
@@ -1490,7 +1508,7 @@
{
alert("Field Error [" + currId + "] - " + facesMessage.getDetail());
}
- }
+ }
// Add the message to the MessageBox
TrMessageBox.addMessage(currId, label, facesMessage);
@@ -1792,7 +1810,7 @@
// create function so that "return" is handled correctly,
var func = new Function("doValidate", onSubmit);
var handlerResult;
-
+
// WindowsMobile 5 doesn't support installing Funtion object
// to "this", so just invoke the Function object instead.
if (_agent.isPIE)
@@ -2594,7 +2612,7 @@
else
{
inputFailures[inputFailures.length] = e.getFacesMessage();
- }
+ }
}
}
}
@@ -3138,7 +3156,7 @@
// functions work
var func = new Function("event", handler);
var result;
-
+
// WindowsMobile 5 doesn't support installing Funtion object
// to "this", so just invoke the Function object instead.
if (_agent.isPIE)
@@ -3156,7 +3174,7 @@
// clear the temporary function
target._tempFunc = (void 0);
- }
+ }
// undefined results should be evaluated as true,
return !(result == false);
@@ -3514,7 +3532,7 @@
{
// No blocking is performed on WM, Nokia, PPC and BlackBerry devices
if (_agent.isPIE || _agent.isNokiaPhone || _agent.isBlackBerry)
- return;
+ return;
if (_agent.isIE)
{
@@ -3577,11 +3595,11 @@
//
function _pprStopBlocking(win)
{
-
+
// No blocking is performed on Nokia, PPC and BlackBerry devices
if (_agent.isPIE || _agent.isNokiaPhone || _agent.isBlackBerry)
return;
-
+
var doc = win.document;
if (win._pprBlocking)
Modified: myfaces/trinidad/trunk/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Window.js
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Window.js?rev=755794&r1=755793&r2=755794&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Window.js (original)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Window.js Thu Mar 19 00:03:29 2009
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -328,7 +328,10 @@
// Set up an onlosecapture handler so that we can
// restore the capture if we unexpectedly lose it.
- parentBody.onlosecapture = _onModalLoseCapture;
+ // this code has been removed as it caused IE to "lock up" when
+ // IE7 is set to force new windows to open in tabs instead of new
+ // windows.
+ //parentBody.onlosecapture = _onModalLoseCapture;
// Popup blockers!
// BUG 4428033 - ECM: MENUS BECOM DISABLED AFTER RAISING A DIALOG
@@ -426,35 +429,6 @@
}
}
-// Called on IE when we lose the capture. As seen in bugs
-// 3613614 and 3540569, IE may unexpectedly lose its capture
-// while a modal window is being displayed. When this occurs,
-// we attempt to restore the capture so that users won't be
-// able to interact with the parent window while a modal child
-// is present.
-function _onModalLoseCapture()
-{
- // We've lost our mouse capture. Check to see whether
- // we still have any modal child windows.
- var modalDependent = _getValidModalDependent(self);
-
- if (modalDependent)
- {
- // If we still have a modal child, we need to re-apply
- // our mouse capture. To do this, we just call _onModalFocus(),
- // which has the necessary code to set the capture.
- //
- // Note, however, that IE doesn't seem to honor the new mouse capture
- // if it is applied from within the onlosecapture handler. To work
- // around this, we queue the call to _onModalFocus(). That way,
- // the capture will be applied after the onlosecapture event
- // has been handled, and IE seems to be happy.
-
- window.setTimeout("_onModalFocus()", 1);
- }
-}
-
-
/**
* onFocus override when modal windows are up.
* Handles moving the focus to the top and suppressing IE mouse clicks.
@@ -676,7 +650,16 @@
// Finally, we can resize the window.
// theWindow.parent.resizeTo(newWidth, newHeight);
- newWin.resizeTo(newWidth, newHeight);
+ try
+ {
+ newWin.resizeTo(newWidth, newHeight);
+ }
+ catch (e)
+ {
+ // ignore errors. An error will be throw if the new window opened in a tab
+ // instead of a new browser window as resizing the main window is prohibited by security
+ ;
+ }
// Check to make sure that our resize hasn't put the
// window partially off screen.