Skip to content

Commit d93daec

Browse files
committed
fix: bail out of event blocking for Adobe CEP bug
Some Adobe CEP environments have a broken Event.timeStamp implementation that breaks event blocking logic. The issue specifically affects host applications running on macOS with CEP version 9.3 and below. This workaround is OS-agnostic so as to maintain identical behavior across platforms. More details can be found in issue vuejs#10366. fix vuejs#10366
1 parent ec78fc8 commit d93daec

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/core/util/env.js

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export const isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform ==
1616
export const isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge
1717
export const isPhantomJS = UA && /phantomjs/.test(UA)
1818
export const isFF = UA && UA.match(/firefox\/(\d+)/)
19+
export const isCEP = inBrowser && window.__adobe_cep__ !== undefined
1920

2021
// Firefox has a "watch" function on Object.prototype...
2122
export const nativeWatch = ({}).watch

src/platforms/web/runtime/modules/events.js

+12-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import { isDef, isUndef } from 'shared/util'
44
import { updateListeners } from 'core/vdom/helpers/index'
5-
import { isIE, isFF, supportsPassive, isUsingMicroTask } from 'core/util/index'
5+
import { isIE, isFF, isCEP, supportsPassive, isUsingMicroTask } from 'core/util/index'
66
import { RANGE_TOKEN, CHECKBOX_RADIO_TOKEN } from 'web/compiler/directives/model'
77
import { currentFlushTimestamp } from 'core/observer/scheduler'
88

@@ -44,6 +44,14 @@ function createOnceHandler (event, handler, capture) {
4444
// safe to exclude.
4545
const useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53)
4646

47+
// #10366: CEP <= 9.3.x has a buggy Event.timeStamp implementation. While the
48+
// issue is restricted to macOS, the fix is OS-agnostic to keep behavioral
49+
// differences to a minimum.
50+
const isCEP93orEarlier = isCEP && ((maxBadMajor, maxBadMinor) => {
51+
const version = JSON.parse(window.__adobe_cep__.getCurrentApiVersion())
52+
return version.major <= maxBadMajor && version.minor <= maxBadMinor
53+
})(9, 3)
54+
4755
function add (
4856
name: string,
4957
handler: Function,
@@ -71,6 +79,9 @@ function add (
7179
// #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
7280
// #9681 QtWebEngine event.timeStamp is negative value
7381
e.timeStamp <= 0 ||
82+
// #10366 Adobe CEP bug: event.timeStamp is not reliable on macOS for
83+
// host applications with CEP versions prior to 9.4.x.
84+
isCEP93orEarlier ||
7485
// #9448 bail if event is fired in another document in a multi-page
7586
// electron/nw.js app, since event.timeStamp will be using a different
7687
// starting reference

0 commit comments

Comments
 (0)