提交 86179384 编写于 作者: Huan (李卓桓)'s avatar Huan (李卓桓)

erge branch 'master' of github.com:zixia/wechaty

......@@ -52,7 +52,7 @@ class Contact {
get(prop) { return this.obj[prop] }
ready(contactGetter) {
log.silly('Contact', 'ready(' + typeof contactGetter + ')')
log.silly('Contact', 'ready(' + (contactGetter ? typeof contactGetter : '') + ')')
if (!this.id) {
log.warn('Contact', 'ready() call on an un-inited contact')
return Promise.resolve(this)
......
......@@ -21,7 +21,7 @@ function unescapeHtml(str) {
}
function digestEmoji(html) {
return html && html
return String(html)
.replace(/<img class="(\w*?emoji) (\w*?emoji[^"]+?)" text="(.*?)_web" src=[^>]+>/g
, '$3') // <img class="emoji emoji1f4a4" text="[流汗]_web" src="/zh_CN/htmledition/v2/images/spacer.gif" />
.replace(/<span class="(\w*?emoji) (\w*?emoji[^"]+?)"><\/span>/g
......
......@@ -43,6 +43,7 @@ class Browser extends EventEmitter {
.catch(e => {
// XXX: must has a `.catch` here, or promise will hang! 2016/6/7
// XXX: if no `.catch` here, promise will hang!
// with selenium-webdriver v2.53.2
// XXX: https://github.com/SeleniumHQ/selenium/issues/2233
log.error('PuppetWebBrowser', 'init() exception: %s', e.message)
throw e
......@@ -71,6 +72,7 @@ class Browser extends EventEmitter {
}
// XXX: if no `setTimeout()` here, promise will hang!
// with selenium-webdriver v2.53.2
// XXX: https://github.com/SeleniumHQ/selenium/issues/2233
setTimeout(() => { resolve(this.driver) }, 0)
// resolve(this.driver)
......@@ -212,6 +214,7 @@ class Browser extends EventEmitter {
})
}
// convert expiry from seconds to milliseconds. https://github.com/SeleniumHQ/selenium/issues/2245
// with selenium-webdriver v2.53.2
// NOTICE: the lastest branch of selenium-webdriver for js has changed the interface of addCookie:
// https://github.com/SeleniumHQ/selenium/commit/02f407976ca1d516826990f11aca7de3c16ba576
if (cookie.expiry) { cookie.expiry = cookie.expiry * 1000 /* XXX: be aware of new version of webdriver */}
......
......@@ -118,7 +118,6 @@ class Server extends EventEmitter {
})
client.on('error' , e => log.error('PuppetWebServer', 'initEventsFromClient() client on error: %s', e))
// client.on('ding' , e => log.silly('PuppetWebServer', 'initEventsFromClient() client on ding: %s', e))
// Events from Wechaty@Broswer --to--> Server
;[
......@@ -131,7 +130,7 @@ class Server extends EventEmitter {
, 'ding'
].map(e => {
client.on(e, data => {
log.silly('PuppetWebServer', `initEventsFromClient() client on event[${e}](${data}) from browser, emit it`)
log.silly('PuppetWebServer', `initEventsFromClient() forward client event[${e}](${data}) from browser by emit it`)
this.emit(e, data)
})
})
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册