blink_local_frame.patch 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
  2. From: Cheng Zhao <[email protected]>
  3. Date: Thu, 20 Sep 2018 17:45:03 -0700
  4. Subject: blink_local_frame.patch
  5. According to electron/electron#3699, it is unreliable to use |unload|
  6. event for process.exit('exit'), so we have to do that in
  7. willReleaseScriptContext.
  8. However Chromium then disallowed scripting in willReleaseScriptContext
  9. in https://codereview.chromium.org/1657583002, and crash will happen
  10. when there is code doing that.
  11. This patch reverts the change to fix the crash in Electron.
  12. diff --git a/third_party/blink/renderer/core/frame/local_frame.cc b/third_party/blink/renderer/core/frame/local_frame.cc
  13. index f7536b085bc5c0fd4853ac905bf7b7c0160d60b7..36303725d92c76581ea91d06674408aa41bbf549 100644
  14. --- a/third_party/blink/renderer/core/frame/local_frame.cc
  15. +++ b/third_party/blink/renderer/core/frame/local_frame.cc
  16. @@ -347,10 +347,6 @@ void LocalFrame::DetachImpl(FrameDetachType type) {
  17. }
  18. CHECK(!view_ || !view_->IsAttached());
  19. - // This is the earliest that scripting can be disabled:
  20. - // - FrameLoader::Detach() can fire XHR abort events
  21. - // - Document::Shutdown() can dispose plugins which can run script.
  22. - ScriptForbiddenScope forbid_script;
  23. if (!Client())
  24. return;
  25. @@ -368,6 +364,10 @@ void LocalFrame::DetachImpl(FrameDetachType type) {
  26. // Notify ScriptController that the frame is closing, since its cleanup ends
  27. // up calling back to LocalFrameClient via WindowProxy.
  28. GetScriptController().ClearForClose();
  29. + // This is the earliest that scripting can be disabled:
  30. + // - FrameLoader::Detach() can fire XHR abort events
  31. + // - Document::Shutdown() can dispose plugins which can run script.
  32. + ScriptForbiddenScope forbid_script;
  33. // TODO(crbug.com/729196): Trace why LocalFrameView::DetachFromLayout crashes.
  34. CHECK(!view_->IsAttached());