mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-09-20 23:36:21 +08:00
bump(electron): Electron 0.27.1, Chromium 43
Summary: 0.27.1? Nope webview still broken Update atom-keymap As of Chromium 42, you cannot subclass CustomEvent or Event using Object.create(event). This caused the CommandRegistry to break. Creating a new object with the properties of the event seems to work fine. Resolves "Deprecated attempt to access property 'target' on a non-Event object. dispatchEvent fireCustomEventevent-test.html:8 global codeevent-test.html:21 event-test.html:8" in Safari and "TypeError: Illegal Invocation" in Chromium Test Plan: Tests still pass Reviewers: evan Reviewed By: evan Differential Revision: https://phab.nylas.com/D1584
This commit is contained in:
parent
215dbbd3f3
commit
bb2c1e30a7
|
@ -11,12 +11,12 @@
|
|||
"bugs": {
|
||||
"url": "https://github.com/nylas/edgehill/issues"
|
||||
},
|
||||
"electronVersion": "0.26.0",
|
||||
"electronVersion": "0.27.2",
|
||||
"dependencies": {
|
||||
"asar": "^0.5.0",
|
||||
"6to5-core": "^3.5",
|
||||
"async": "^0.9",
|
||||
"atom-keymap": "^3.1",
|
||||
"atom-keymap": "^5.1",
|
||||
"autolinker": "0.15.2",
|
||||
"bluebird": "^2.9",
|
||||
"clear-cut": "0.4.0",
|
||||
|
|
|
@ -167,12 +167,11 @@ class CommandRegistry
|
|||
# * `commandName` {String} indicating the name of the command to dispatch.
|
||||
dispatch: (target, commandName, detail) ->
|
||||
event = new CustomEvent(commandName, {bubbles: true, detail})
|
||||
eventWithTarget = Object.create event,
|
||||
target: value: target
|
||||
preventDefault: value: ->
|
||||
stopPropagation: value: ->
|
||||
stopImmediatePropagation: value: ->
|
||||
@handleCommandEvent(eventWithTarget)
|
||||
Object.defineProperty(event, 'target', {value: target})
|
||||
Object.defineProperty(event, 'preventDefault', {value: -> })
|
||||
Object.defineProperty(event, 'stopPropagation', {value: -> })
|
||||
Object.defineProperty(event, 'stopImmediatePropagation', {value: -> })
|
||||
@handleCommandEvent(event)
|
||||
|
||||
onWillDispatch: (callback) ->
|
||||
@emitter.on 'will-dispatch', callback
|
||||
|
@ -194,7 +193,8 @@ class CommandRegistry
|
|||
matched = false
|
||||
currentTarget = originalEvent.target
|
||||
|
||||
syntheticEvent = Object.create originalEvent,
|
||||
syntheticEvent = _.extend({}, originalEvent)
|
||||
syntheticEventProps =
|
||||
eventPhase: value: Event.BUBBLING_PHASE
|
||||
currentTarget: get: -> currentTarget
|
||||
preventDefault: value: ->
|
||||
|
@ -209,6 +209,9 @@ class CommandRegistry
|
|||
abortKeyBinding: value: ->
|
||||
originalEvent.abortKeyBinding?()
|
||||
|
||||
for prop, def in syntheticEventProps
|
||||
Object.defineProperty(syntheticEvent, prop, def)
|
||||
|
||||
@emitter.emit 'will-dispatch', syntheticEvent
|
||||
|
||||
loop
|
||||
|
|
|
@ -3,13 +3,23 @@ path = require 'path'
|
|||
KeymapManager = require 'atom-keymap'
|
||||
CSON = require 'season'
|
||||
{jQuery} = require 'space-pen'
|
||||
Grim = require 'grim'
|
||||
|
||||
bundledKeymaps = require('../package.json')?._atomKeymaps
|
||||
|
||||
KeymapManager::onDidLoadBundledKeymaps = (callback) ->
|
||||
@emitter.on 'did-load-bundled-keymaps', callback
|
||||
|
||||
KeymapManager::loadBundledKeymaps = ->
|
||||
@loadKeymap(path.join(@resourcePath, 'keymaps'))
|
||||
@emit 'bundled-keymaps-loaded'
|
||||
keymapsPath = path.join(@resourcePath, 'keymaps')
|
||||
if bundledKeymaps?
|
||||
for keymapName, keymap of bundledKeymaps
|
||||
keymapPath = path.join(keymapsPath, keymapName)
|
||||
@add(keymapPath, keymap)
|
||||
else
|
||||
@loadKeymap(keymapsPath)
|
||||
|
||||
@emit 'bundled-keymaps-loaded' if Grim.includeDeprecatedAPIs
|
||||
@emitter.emit 'did-load-bundled-keymaps'
|
||||
|
||||
KeymapManager::getUserKeymapPath = ->
|
||||
|
@ -50,7 +60,7 @@ KeymapManager::subscribeToFileReadFailure = ->
|
|||
else
|
||||
error.message
|
||||
|
||||
atom.notifications.addError(message, {detail: detail, dismissable: true})
|
||||
atom.notifications.addError(message, {detail, dismissable: true})
|
||||
|
||||
# This enables command handlers registered via jQuery to call
|
||||
# `.abortKeyBinding()` on the `jQuery.Event` object passed to the handler.
|
||||
|
|
Loading…
Reference in a new issue