Author: yurize
Date: Mon Oct 1 10:59:10 2012
New Revision: 1392275
URL: http://svn.apache.org/viewvc?rev=1392275&view=rev
Log:
Fixes the copy-paste issue in FF15. By Vicente J. Ruiz Jurado.
https://reviews.apache.org/r/7142
Added:
incubator/wave/trunk/src/org/waveprotocol/wave/client/clipboard/PasteBufferImplOldFirefox.java
- copied, changed from r1389831,
incubator/wave/trunk/src/org/waveprotocol/wave/client/clipboard/PasteBufferImplFirefox.java
incubator/wave/trunk/src/org/waveprotocol/wave/client/clipboard/PasteBufferImplSafariAndNewFirefox.java
- copied, changed from r1389831,
incubator/wave/trunk/src/org/waveprotocol/wave/client/clipboard/PasteBufferImplSafari.java
Removed:
incubator/wave/trunk/src/org/waveprotocol/wave/client/clipboard/PasteBufferImplFirefox.java
incubator/wave/trunk/src/org/waveprotocol/wave/client/clipboard/PasteBufferImplSafari.java
Modified:
incubator/wave/trunk/src/org/waveprotocol/wave/client/clipboard/PasteBufferImpl.java
incubator/wave/trunk/src/org/waveprotocol/wave/client/common/util/QuirksConstants.java
incubator/wave/trunk/src/org/waveprotocol/wave/client/common/util/UserAgentRuntimeProperties.java
Modified:
incubator/wave/trunk/src/org/waveprotocol/wave/client/clipboard/PasteBufferImpl.java
URL:
http://svn.apache.org/viewvc/incubator/wave/trunk/src/org/waveprotocol/wave/client/clipboard/PasteBufferImpl.java?rev=1392275&r1=1392274&r2=1392275&view=diff
==============================================================================
---
incubator/wave/trunk/src/org/waveprotocol/wave/client/clipboard/PasteBufferImpl.java
(original)
+++
incubator/wave/trunk/src/org/waveprotocol/wave/client/clipboard/PasteBufferImpl.java
Mon Oct 1 10:59:10 2012
@@ -50,13 +50,13 @@ public class PasteBufferImpl {
*/
static PasteBufferImpl create() {
PasteBufferImpl pasteBuffer;
-
- if (UserAgent.isSafari()) {
- pasteBuffer = new PasteBufferImplSafari();
+
+ if (UserAgent.isSafari() || QuirksConstants.FIREFOX_GREATER_THAN_VER_15) {
+ pasteBuffer = new PasteBufferImplSafariAndNewFirefox();
} else if (UserAgent.isFirefox() &&
!QuirksConstants.SANITIZES_PASTED_CONTENT) {
// Older versions of firefox doesn't sanitize pasted content and
requires the
// paste buffer to be an iframe to prevent XSS.
- pasteBuffer = new PasteBufferImplFirefox();
+ pasteBuffer = new PasteBufferImplOldFirefox();
} else {
pasteBuffer = new PasteBufferImpl();
}
Copied:
incubator/wave/trunk/src/org/waveprotocol/wave/client/clipboard/PasteBufferImplOldFirefox.java
(from r1389831,
incubator/wave/trunk/src/org/waveprotocol/wave/client/clipboard/PasteBufferImplFirefox.java)
URL:
http://svn.apache.org/viewvc/incubator/wave/trunk/src/org/waveprotocol/wave/client/clipboard/PasteBufferImplOldFirefox.java?p2=incubator/wave/trunk/src/org/waveprotocol/wave/client/clipboard/PasteBufferImplOldFirefox.java&p1=incubator/wave/trunk/src/org/waveprotocol/wave/client/clipboard/PasteBufferImplFirefox.java&r1=1389831&r2=1392275&rev=1392275&view=diff
==============================================================================
---
incubator/wave/trunk/src/org/waveprotocol/wave/client/clipboard/PasteBufferImplFirefox.java
(original)
+++
incubator/wave/trunk/src/org/waveprotocol/wave/client/clipboard/PasteBufferImplOldFirefox.java
Mon Oct 1 10:59:10 2012
@@ -25,7 +25,7 @@ import org.waveprotocol.wave.client.edit
import org.waveprotocol.wave.model.document.util.Point;
/**
- * Firefox implementation of the paste buffer. We cannot use a standard div set
+ * Firefox old implementation of the paste buffer. We cannot use a standard
div set
* to contentEditable because pasting any javascript will automatically
* execute it. Instead, use an offscreen iframe whose document is set to
* "designMode". This is roughly equivalent to contentEditable with the
@@ -47,10 +47,10 @@ import org.waveprotocol.wave.model.docum
* event, we are not protected.
*
* Tested on: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.2)
- * Gecko/20100115 Firefox/3.6 GTB7.0
+ * Gecko/20100115 Firefox/3.6 GTB7.0 < 15.0
*
*/
-class PasteBufferImplFirefox extends PasteBufferImpl {
+class PasteBufferImplOldFirefox extends PasteBufferImpl {
private final IFrameElement iframe;
@@ -58,7 +58,7 @@ class PasteBufferImplFirefox extends Pas
* Protected empty constructor. Will be created by factory constructor in
* PasteBufferImpl.
*/
- protected PasteBufferImplFirefox() {
+ protected PasteBufferImplOldFirefox() {
iframe = Document.get().createIFrameElement();
}
Copied:
incubator/wave/trunk/src/org/waveprotocol/wave/client/clipboard/PasteBufferImplSafariAndNewFirefox.java
(from r1389831,
incubator/wave/trunk/src/org/waveprotocol/wave/client/clipboard/PasteBufferImplSafari.java)
URL:
http://svn.apache.org/viewvc/incubator/wave/trunk/src/org/waveprotocol/wave/client/clipboard/PasteBufferImplSafariAndNewFirefox.java?p2=incubator/wave/trunk/src/org/waveprotocol/wave/client/clipboard/PasteBufferImplSafariAndNewFirefox.java&p1=incubator/wave/trunk/src/org/waveprotocol/wave/client/clipboard/PasteBufferImplSafari.java&r1=1389831&r2=1392275&rev=1392275&view=diff
==============================================================================
---
incubator/wave/trunk/src/org/waveprotocol/wave/client/clipboard/PasteBufferImplSafari.java
(original)
+++
incubator/wave/trunk/src/org/waveprotocol/wave/client/clipboard/PasteBufferImplSafariAndNewFirefox.java
Mon Oct 1 10:59:10 2012
@@ -31,8 +31,10 @@ import org.waveprotocol.wave.model.docum
* leading and trailing inline text. If that is not present, we sometimes
* cannot tell the difference between a new paragraph or inline text.
*
+ * Also works for Firefox >= 15
+ *
*/
-class PasteBufferImplSafari extends PasteBufferImpl {
+class PasteBufferImplSafariAndNewFirefox extends PasteBufferImpl {
private boolean markersStripped = false;
Modified:
incubator/wave/trunk/src/org/waveprotocol/wave/client/common/util/QuirksConstants.java
URL:
http://svn.apache.org/viewvc/incubator/wave/trunk/src/org/waveprotocol/wave/client/common/util/QuirksConstants.java?rev=1392275&r1=1392274&r2=1392275&view=diff
==============================================================================
---
incubator/wave/trunk/src/org/waveprotocol/wave/client/common/util/QuirksConstants.java
(original)
+++
incubator/wave/trunk/src/org/waveprotocol/wave/client/common/util/QuirksConstants.java
Mon Oct 1 10:59:10 2012
@@ -370,7 +370,7 @@ public final class QuirksConstants {
*/
public static final boolean PLAINTEXT_PASTE_DOES_NOT_EMIT_PASTE_EVENT =
UserAgent.isSafari();
-
+
/**
* True if the browser supports input type 'search'.
*
@@ -391,6 +391,15 @@ public final class QuirksConstants {
(UserAgent.isWebkit() && UserAgent.isAtLeastVersion(533, 16)) ||
(UserAgent.isFirefox() && UserAgent.isAtLeastVersion(4, 0));
+ /**
+ * True if the browser is firefox >= 15
+ *
+ * Tested:
+ * FF 13, FF 14, FF 15
+ */
+ public static final boolean FIREFOX_GREATER_THAN_VER_15 =
+ (UserAgent.isFirefox() && UserAgent.isAtLeastVersion(15, 0));
+
private static native boolean checkGetElementsByClassNameSupport() /*-{
return !!document.body.getElementsByClassName;
}-*/;
Modified:
incubator/wave/trunk/src/org/waveprotocol/wave/client/common/util/UserAgentRuntimeProperties.java
URL:
http://svn.apache.org/viewvc/incubator/wave/trunk/src/org/waveprotocol/wave/client/common/util/UserAgentRuntimeProperties.java?rev=1392275&r1=1392274&r2=1392275&view=diff
==============================================================================
---
incubator/wave/trunk/src/org/waveprotocol/wave/client/common/util/UserAgentRuntimeProperties.java
(original)
+++
incubator/wave/trunk/src/org/waveprotocol/wave/client/common/util/UserAgentRuntimeProperties.java
Mon Oct 1 10:59:10 2012
@@ -32,7 +32,7 @@ public class UserAgentRuntimeProperties
private static final UserAgentRuntimeProperties INSTANCE = createInstance();
private static UserAgentRuntimeProperties createInstance() {
- return GWT.isScript() ? new
UserAgentRuntimeProperties(getNativeUserAgent())
+ return GWT.isClient() ? new
UserAgentRuntimeProperties(getNativeUserAgent())
: new UserAgentRuntimeProperties("");
}