I have a Chrome extension that does some basic automation against Netflix. I have this line that scrolls back or forward:
netflix.cadmium.UiEvents.events.resize[1].scope.events.dragend[trickyIndex].handler(null, {value: 123, pointerEventData: {playing: true}});
When trickyIndexequal to 1, it only works fine if the Netflix slider remains untouched. If the viewer drags the slider forward or backward or uses the arrow keys forward or backward to scroll backward or forward, the next time this line is called, it produces one of the following errors:
Uncaught TypeError: cannot read undefined property handler
or...
Unable to read property 'target' null
The second error shown is the most common, but I also saw 1st place.
They seem to use the Observable pattern with RxJSand react-redux.
But after the slider (or arrows) is moved by the viewer, the line above will work fine since if it trickyIndexis 0. Regardless of how many times it is called again or the user jumps back or forward, a trickyIndexof 0 will always work. but a trickyIndexof 1 will always cause the error shown above.
If I start from trickyIndex0 from the beginning, it throws an error. It works correctly only after the user performs a manual check with the slider or arrows.
: , , /. , trickyIndex, , . . , try/catch . , , . , 1, , , 0, , , . catch , .
, , /:
netflix.cadmium.UiEvents.events.resize.forEach(function(resizeItem) {
if (resizeItem.scope) {
resizeItem.scope.events.dragend.forEach(function(dragendItem) {
if (dragendItem.scope) {
dragendItem.handler(null, {
value: 123,
pointerEventData: {playing: true}
});
}
});
}
});
, foreach , foreach (dragendItem.scope null). , : netflix.cadmium.UiEvents.events.resize[1].scope.events.dragend[trickyIndex].handler(null, {value: 123, pointerEventData: {playing: true}}); - .
?