iitc-project / ingress-intel-total-conversion

ingress.com/intel total conversion user script with some new features. Should allow easier extension of the intel map.
http://iitc.jonatkins.com/
ISC License
991 stars 552 forks source link

7998: Unable to preventDefault inside passive event listener due to target being treated as passive #1260

Open ReinRaus opened 6 years ago

ReinRaus commented 6 years ago

See https://www.chromestatus.com/features/5093566007214080 In latest versions Android System WebView application dont work stably. Full text from console:

WARN iitcm-console <script/total-conversion-build.user.js>:7998: Unable to preventDefault inside passive event listener due to target being treated as passive. See https://www.chromestatus.com/features/5093566007214080

This module fixes this bug: https://unpkg.com/default-passive-events but in default settings need change passive to false.

Original module code:

u={passive:!0,capture:!1}

needs for IITC stable work:

u={passive:!1,capture:!1}
ReinRaus commented 6 years ago

@Guria я призываю Вас, потому что пишу по-русски и готов досконально объяснить проблему. Я опросил игроков в своём регионе и почти все они сказали, что сталкиваются с такой же проблемой, но терпят её. Я пишу иссуй, потому что сам не нашел адекватного способа сделать красивое исправление, чтобы для событий тачскрина устанавливалось свойство passive = false. Поэтому я привел код, который делает это для всех событий. Я не нашел адекватного способа, потому что сам плохо знаком с кодом IITC, но Вы должны знать его значительно лучше.

Guria commented 6 years ago

Привет. Я не до конца понимаю проблему. И ещё больше я недоумеваю, почему вы обратились именно ко мне. Честное слово, я в полнейшем замешательстве. Я мог решить, что вы ошиблись, но я, действительно, когда то играл в Ingress и даже пользовался iitc. Возможно я когда то пытался разобраться в коде и даже писать плагины, но я точно не являюсь экспертом в iitc. Тем более сейчас, когда я уже несколько лет как не запускал игру.

blast-from-the-past

ReinRaus commented 6 years ago

@guria не туда посмотрел :( подумал, что Вы мейнтейнер :-)

ReinRaus commented 6 years ago

Проблема в том, что ради увеличения производительности и плавности картинки хром сделал все события тачскрина пассивными по-умолчанию. В ИИТЦ везде где только можно используется подавление событий вызовом preventDefault и в итоге обновив Android System WebView до последней версии получим нерабочий ИИТЦ.

Guria commented 6 years ago

Любопытно где все таки попался мой ник, что вы так перепутали. Меня с этим репозиторием кажется связывает только один коммит и возможно пара ишью. :) На счёт preventDefault реально не готов помочь :(

ReinRaus commented 6 years ago

@Guria когда вводишь собаку- то Вы на первом месте были в дополнениях :) А по проблеме - я нашел готовое решение в виде модуля https://unpkg.com/default-passive-events с ним ничего не тормозит и работает как надо. Извините за беспокойство. Возвращайтесь в ingress :)

nhamer commented 6 years ago

What actual problem does this cause in IITC?

ReinRaus commented 6 years ago

@nhamer
https://www.chromestatus.com/feature/5745543795965952
Broken events in IITC mobile:
touchstart mousewheel wheel touchstart touchmove
The browser cancels event handlers to optimize page rendering. Because of this, work breaks down IITC Mobile.

[Violation] Added non-passive event listener to a scroll-blocking <some> event. Consider marking event handler as 'passive' to make the page more responsive. See <URL>
intel:40 [Violation] Added non-passive event listener to a scroll-blocking 'touchstart' event. Consider marking event handler as 'passive' to make the page more responsive. See https://www.chromestatus.com/feature/5745543795965952
intel:77 [Violation] Added non-passive event listener to a scroll-blocking 'touchstart' event. Consider marking event handler as 'passive' to make the page more responsive. See https://www.chromestatus.com/feature/5745543795965952
intel:110 [Violation] Added non-passive event listener to a scroll-blocking 'touchstart' event. Consider marking event handler as 'passive' to make the page more responsive. See https://www.chromestatus.com/feature/5745543795965952
VM1280:7765 [Violation] Added non-passive event listener to a scroll-blocking 'mousewheel' event. Consider marking event handler as 'passive' to make the page more responsive. See https://www.chromestatus.com/feature/5745543795965952
addListener @ VM1280:7765
addHooks @ VM1280:8345
enable @ VM1280:8133
addHandler @ VM1280:3104
init @ VM1280:1635
proto.callInitHooks @ VM1280:1612
initialize @ VM1280:2874
NewClass @ VM1280:1549
window.setupMap @ VM1280:594
boot @ VM1280:1198
(anonymous) @ VM1280:1288
a.next @ VM1280:1288
d @ VM1280:1288
VM1280:7765 [Violation] Added non-passive event listener to a scroll-blocking 'mousewheel' event. Consider marking event handler as 'passive' to make the page more responsive. See https://www.chromestatus.com/feature/5745543795965952
addListener @ VM1280:7765
disableScrollPropagation @ VM1280:7848
_initLayout @ VM1280:9768
onAdd @ VM1280:9723
addTo @ VM1280:9284
addControl @ VM1280:9329
window.setupMap @ VM1280:730
boot @ VM1280:1198
(anonymous) @ VM1280:1288
a.next @ VM1280:1288
d @ VM1280:1288
content.js:1 [Violation] Added non-passive event listener to a scroll-blocking 'wheel' event. Consider marking event handler as 'passive' to make the page more responsive. See https://www.chromestatus.com/feature/5745543795965952
T.attach @ content.js:1
(anonymous) @ content.js:1
EventImpl.dispatchToListener @ VM1292 extensions::event_bindings:403
publicClassPrototype.(anonymous function) @ VM1298 extensions::utils:138
EventImpl.dispatch_ @ VM1292 extensions::event_bindings:387
EventImpl.dispatch @ VM1292 extensions::event_bindings:409
publicClassPrototype.(anonymous function) @ VM1298 extensions::utils:138
messageListener @ VM1299 extensions::messaging:240
EventImpl.dispatchToListener @ VM1292 extensions::event_bindings:403
publicClassPrototype.(anonymous function) @ VM1298 extensions::utils:138
EventImpl.dispatch_ @ VM1292 extensions::event_bindings:387
EventImpl.dispatch @ VM1292 extensions::event_bindings:409
publicClassPrototype.(anonymous function) @ VM1298 extensions::utils:138
dispatchOnMessage @ VM1299 extensions::messaging:392
util.js:53 [Violation] Added non-passive event listener to a scroll-blocking 'touchstart' event. Consider marking event handler as 'passive' to make the page more responsive. See https://www.chromestatus.com/feature/5745543795965952
(anonymous) @ util.js:53
jD @ util.js:53
_.pH @ util.js:140
WY @ onion.js:55
ZY.f @ onion.js:73
(anonymous) @ map.js:63
(anonymous) @ js?client=gme-nianticinc&sensor=true&v=3.12:125
(anonymous) @ js?client=gme-nianticinc&sensor=true&v=3.12:60
(anonymous) @ js?client=gme-nianticinc&sensor=true&v=3.12:125
(anonymous) @ js?client=gme-nianticinc&sensor=true&v=3.12:60
(anonymous) @ js?client=gme-nianticinc&sensor=true&v=3.12:125
ae @ js?client=gme-nianticinc&sensor=true&v=3.12:62
$d.na @ js?client=gme-nianticinc&sensor=true&v=3.12:125
(anonymous) @ util.js:1
util.js:53 [Violation] Added non-passive event listener to a scroll-blocking 'touchmove' event. Consider marking event handler as 'passive' to make the page more responsive. See https://www.chromestatus.com/feature/5745543795965952
nhamer commented 6 years ago

https://www.chromestatus.com/feature/5093566007214080

So this (passive event listeners) should only be defaulting to true for document-level events.

The violations are a little noisy, but leaflet is in fact attempting to block those events, so defaulting them to passive is wrong. (Leaflet/issues/5004)