Fix unsafeWindow for the newer versions of Chrome. #968
This commit is contained in:
parent
7cfd5e9d5d
commit
ffea1676fd
12
lib/$.coffee
12
lib/$.coffee
@ -193,9 +193,15 @@ $.extend $,
|
||||
unsafeWindow
|
||||
else # Chrome
|
||||
do ->
|
||||
p = d.createElement 'p'
|
||||
p.setAttribute 'onclick', 'return window'
|
||||
p.onclick()
|
||||
uw = null
|
||||
captureUW = (e) -> uw = e.detail
|
||||
window.addEventListener 'unsafe', captureUW, false
|
||||
s = d.createElement 'script'
|
||||
s.textContent = 'window.dispatchEvent(new CustomEvent("unsafe", {detail: window}))'
|
||||
(d.head or doc).appendChild s
|
||||
s.parentNode.removeChild s
|
||||
window.removeEventListener 'unsafe', captureUW, false
|
||||
uw
|
||||
bytesToString: (size) ->
|
||||
unit = 0 # Bytes
|
||||
while size >= 1024
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user