mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-09-27 15:04:31 +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
3 changed files with 25 additions and 12 deletions
|
@ -11,12 +11,12 @@
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/nylas/edgehill/issues"
|
"url": "https://github.com/nylas/edgehill/issues"
|
||||||
},
|
},
|
||||||
"electronVersion": "0.26.0",
|
"electronVersion": "0.27.2",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"asar": "^0.5.0",
|
"asar": "^0.5.0",
|
||||||
"6to5-core": "^3.5",
|
"6to5-core": "^3.5",
|
||||||
"async": "^0.9",
|
"async": "^0.9",
|
||||||
"atom-keymap": "^3.1",
|
"atom-keymap": "^5.1",
|
||||||
"autolinker": "0.15.2",
|
"autolinker": "0.15.2",
|
||||||
"bluebird": "^2.9",
|
"bluebird": "^2.9",
|
||||||
"clear-cut": "0.4.0",
|
"clear-cut": "0.4.0",
|
||||||
|
|
|
@ -167,12 +167,11 @@ class CommandRegistry
|
||||||
# * `commandName` {String} indicating the name of the command to dispatch.
|
# * `commandName` {String} indicating the name of the command to dispatch.
|
||||||
dispatch: (target, commandName, detail) ->
|
dispatch: (target, commandName, detail) ->
|
||||||
event = new CustomEvent(commandName, {bubbles: true, detail})
|
event = new CustomEvent(commandName, {bubbles: true, detail})
|
||||||
eventWithTarget = Object.create event,
|
Object.defineProperty(event, 'target', {value: target})
|
||||||
target: value: target
|
Object.defineProperty(event, 'preventDefault', {value: -> })
|
||||||
preventDefault: value: ->
|
Object.defineProperty(event, 'stopPropagation', {value: -> })
|
||||||
stopPropagation: value: ->
|
Object.defineProperty(event, 'stopImmediatePropagation', {value: -> })
|
||||||
stopImmediatePropagation: value: ->
|
@handleCommandEvent(event)
|
||||||
@handleCommandEvent(eventWithTarget)
|
|
||||||
|
|
||||||
onWillDispatch: (callback) ->
|
onWillDispatch: (callback) ->
|
||||||
@emitter.on 'will-dispatch', callback
|
@emitter.on 'will-dispatch', callback
|
||||||
|
@ -194,7 +193,8 @@ class CommandRegistry
|
||||||
matched = false
|
matched = false
|
||||||
currentTarget = originalEvent.target
|
currentTarget = originalEvent.target
|
||||||
|
|
||||||
syntheticEvent = Object.create originalEvent,
|
syntheticEvent = _.extend({}, originalEvent)
|
||||||
|
syntheticEventProps =
|
||||||
eventPhase: value: Event.BUBBLING_PHASE
|
eventPhase: value: Event.BUBBLING_PHASE
|
||||||
currentTarget: get: -> currentTarget
|
currentTarget: get: -> currentTarget
|
||||||
preventDefault: value: ->
|
preventDefault: value: ->
|
||||||
|
@ -209,6 +209,9 @@ class CommandRegistry
|
||||||
abortKeyBinding: value: ->
|
abortKeyBinding: value: ->
|
||||||
originalEvent.abortKeyBinding?()
|
originalEvent.abortKeyBinding?()
|
||||||
|
|
||||||
|
for prop, def in syntheticEventProps
|
||||||
|
Object.defineProperty(syntheticEvent, prop, def)
|
||||||
|
|
||||||
@emitter.emit 'will-dispatch', syntheticEvent
|
@emitter.emit 'will-dispatch', syntheticEvent
|
||||||
|
|
||||||
loop
|
loop
|
||||||
|
|
|
@ -3,13 +3,23 @@ path = require 'path'
|
||||||
KeymapManager = require 'atom-keymap'
|
KeymapManager = require 'atom-keymap'
|
||||||
CSON = require 'season'
|
CSON = require 'season'
|
||||||
{jQuery} = require 'space-pen'
|
{jQuery} = require 'space-pen'
|
||||||
|
Grim = require 'grim'
|
||||||
|
|
||||||
|
bundledKeymaps = require('../package.json')?._atomKeymaps
|
||||||
|
|
||||||
KeymapManager::onDidLoadBundledKeymaps = (callback) ->
|
KeymapManager::onDidLoadBundledKeymaps = (callback) ->
|
||||||
@emitter.on 'did-load-bundled-keymaps', callback
|
@emitter.on 'did-load-bundled-keymaps', callback
|
||||||
|
|
||||||
KeymapManager::loadBundledKeymaps = ->
|
KeymapManager::loadBundledKeymaps = ->
|
||||||
@loadKeymap(path.join(@resourcePath, 'keymaps'))
|
keymapsPath = path.join(@resourcePath, 'keymaps')
|
||||||
@emit 'bundled-keymaps-loaded'
|
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'
|
@emitter.emit 'did-load-bundled-keymaps'
|
||||||
|
|
||||||
KeymapManager::getUserKeymapPath = ->
|
KeymapManager::getUserKeymapPath = ->
|
||||||
|
@ -50,7 +60,7 @@ KeymapManager::subscribeToFileReadFailure = ->
|
||||||
else
|
else
|
||||||
error.message
|
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
|
# This enables command handlers registered via jQuery to call
|
||||||
# `.abortKeyBinding()` on the `jQuery.Event` object passed to the handler.
|
# `.abortKeyBinding()` on the `jQuery.Event` object passed to the handler.
|
||||||
|
|
Loading…
Add table
Reference in a new issue