Fix crash in PauseContext/UnpauseContext.

It is possible that the frame becomes detached from the document
after dispatching the event. This is the only way the FrameScheduler
could be null. I previously checked it in SetLifecycleState in
change https://chromium.googlesource.com/chromium/src.git/+/42b61856cfd1b63bed1a1cae45cac6b7e41e9e0f
and that seemed to decrease the number of crashes, but they still
seem to exist. These additional checks should cover those situations.

BUG=994442

Change-Id: I59ad0e4f4e047f4548c72ad103691a260290626e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1798888
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#695813}
1 file changed