Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

convert javascript snippets to standalone embedded js files (part 1) #852

Merged
merged 5 commits into from Jul 12, 2021

Commits on Jul 12, 2021

  1. Copy the full SHA
    22ab050 View commit details
    Browse the repository at this point in the history
  2. Copy the full SHA
    b8009bc View commit details
    Browse the repository at this point in the history
  3. encapsulate runtime.CallFunctionOn

    The advantages of runtime.CallFunctionOn are:
    
    1. it's safe to pass arguments into js;
    2. the js function can be bound to a remote object (accessed by "this").
    
    So that we can use runtime.CallFunctionOn to run js function without
    constructing js dynamically.
    ZekeLu committed Jul 12, 2021
    Copy the full SHA
    dc8dd87 View commit details
    Browse the repository at this point in the history
  4. Copy the full SHA
    94cf82e View commit details
    Browse the repository at this point in the history
  5. replace Evaluate with CallFunctionOn to execuate js on node

    Note: there is a performance cost here.
    
    Before the changes, just one CDP command is sent:
    - Runtime.evaluate
    
    After the changes, three CDP command are sent:
    - DOM.resolveNode: to get the RemoteObjectId from NodeId
    - Runtime.callFunctionOn
    - Runtime.releaseObject
    ZekeLu committed Jul 12, 2021
    Copy the full SHA
    0de4f60 View commit details
    Browse the repository at this point in the history