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
|
unsafeWindow
|
||||||
else # Chrome
|
else # Chrome
|
||||||
do ->
|
do ->
|
||||||
p = d.createElement 'p'
|
uw = null
|
||||||
p.setAttribute 'onclick', 'return window'
|
captureUW = (e) -> uw = e.detail
|
||||||
p.onclick()
|
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) ->
|
bytesToString: (size) ->
|
||||||
unit = 0 # Bytes
|
unit = 0 # Bytes
|
||||||
while size >= 1024
|
while size >= 1024
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user