Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bail out of event blocking for Adobe CEP bug (fix #10366) #10459

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/core/util/env.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
/* @flow */

import { isObject } from 'shared/util'

// can we use __proto__?
export const hasProto = '__proto__' in {}

Expand All @@ -16,6 +18,7 @@ export const isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform ==
export const isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge
export const isPhantomJS = UA && /phantomjs/.test(UA)
export const isFF = UA && UA.match(/firefox\/(\d+)/)
export const isCEP = inBrowser && isObject(window.__adobe_cep__)

// Firefox has a "watch" function on Object.prototype...
export const nativeWatch = ({}).watch
Expand Down
15 changes: 14 additions & 1 deletion src/platforms/web/runtime/modules/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { isDef, isUndef } from 'shared/util'
import { updateListeners } from 'core/vdom/helpers/index'
import { isIE, isFF, supportsPassive, isUsingMicroTask } from 'core/util/index'
import { isIE, isFF, isCEP, supportsPassive, isUsingMicroTask } from 'core/util/index'
import { RANGE_TOKEN, CHECKBOX_RADIO_TOKEN } from 'web/compiler/directives/model'
import { currentFlushTimestamp } from 'core/observer/scheduler'

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

// #10366: CEP <= 9.3.x has a buggy Event.timeStamp implementation. While the
// issue is restricted to macOS, the fix is OS-agnostic to keep behavioral
// differences to a minimum.
const isCEP93orEarlier = isCEP &&
(typeof window.__adobe_cep__.getCurrentApiVersion !== 'function' ||
((maxBadMajor, maxBadMinor) => {
const version = JSON.parse(window.__adobe_cep__.getCurrentApiVersion())
ericdrobinson marked this conversation as resolved.
Show resolved Hide resolved
return version.major <= maxBadMajor && version.minor <= maxBadMinor
})(9, 3))

function add (
name: string,
handler: Function,
Expand Down Expand Up @@ -71,6 +81,9 @@ function add (
// #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
// #9681 QtWebEngine event.timeStamp is negative value
e.timeStamp <= 0 ||
// #10366 Adobe CEP bug: event.timeStamp is not reliable on macOS for
// host applications with CEP versions prior to 9.4.x.
isCEP93orEarlier ||
// #9448 bail if event is fired in another document in a multi-page
// electron/nw.js app, since event.timeStamp will be using a different
// starting reference
Expand Down