Git Product home page Git Product logo

webkit_inspection_protocol.dart's Introduction

Dart pub package package publisher

The webkit_inspection_protocol package is a client for the Chrome DevTools Protocol (previously called the Webkit Inspection Protocol). It's used to talk to Chrome DevTools based debuggers.

The protocol

Read more about the protocol here.

Disclaimer

This is not an official Google product.

webkit_inspection_protocol.dart's People

Contributors

annagrin avatar dependabot[bot] avatar devoncarew avatar drmarcii avatar grouma avatar jakemac53 avatar kevmoo avatar liuming0 avatar srawlins avatar tvolkert avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

webkit_inspection_protocol.dart's Issues

Intermittent failures to get tabs from chrome

Original issue: flutter/flutter#94886

We see those errors from time to time on our test servers. Looks like sometimes chrome returns html instead of json for the list of tabs - is it possible to catch the error and retry in this case?

  [+1744 ms] FormatException: Unexpected character (at character 1)
             <html>
             ^
  
             #0      _ChunkedJsonParser.fail (dart:convert-patch/convert_patch.dart:1383:5)
             #1      _ChunkedJsonParser.parseNumber (dart:convert-patch/convert_patch.dart:1250:9)
             #2      _ChunkedJsonParser.parse (dart:convert-patch/convert_patch.dart:915:22)
             #3      _parseJson (dart:convert-patch/convert_patch.dart:35:10)
             #4      JsonDecoder.convert (dart:convert/json.dart:612:36)
             #5      JsonCodec.decode (dart:convert/json.dart:216:41)
             #6      jsonDecode (dart:convert/json.dart:155:10)
             #7      ChromeConnection.getTabs (package:webkit_inspection_protocol/webkit_inspection_protocol.dart:44:10)
             <asynchronous suspension>
             #8      ChromeConnection.getTab (package:webkit_inspection_protocol/webkit_inspection_protocol.dart:57:25)
             <asynchronous suspension>
             #9      ChromiumLauncher._connect (package:flutter_tools/src/web/chrome.dart:401:9)
             <asynchronous suspension>
             #10     ChromiumDevice.startApp (package:flutter_tools/src/web/web_device.dart:145:17)
             <asynchronous suspension>
             #11     ResidentWebRunner.run.<anonymous closure> (package:flutter_tools/src/isolated/resident_web_runner.dart:307:9)
             <asynchronous suspension>
             #12     asyncGuard.<anonymous closure> (package:flutter_tools/src/base/async_guard.dart:111:24)
             <asynchronous suspension>
  
  Unable to connect to Chrome debug port: 42255
   FormatException: Unexpected character (at character 1)
  <html>
  ^
  
  
  #0      throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
  #1      ChromiumLauncher._connect (package:flutter_tools/src/web/chrome.dart:406:9)
  <asynchronous suspension>
  #2      ChromiumDevice.startApp (package:flutter_tools/src/web/web_device.dart:145:17)
  <asynchronous suspension>
  #3      ResidentWebRunner.run.<anonymous closure> (package:flutter_tools/src/isolated/resident_web_runner.dart:307:9)
  <asynchronous suspension>
  #4      asyncGuard.<anonymous closure> (package:flutter_tools/src/base/async_guard.dart:111:24)
  <asynchronous suspension>

Runtime failure on assert inside eval

Description

Try to evaluate and expression containing an assert statement (needs to run ddc with assertions enabled).

The evaluation fails with a null cast error in runtime.dart:240 (the ExceptionDetails's url is null for the JS code evaluated during expression evaluation).

Suggestion

Allow null url in ExceptionDetails

RemoteObject.value is incorrectly typed

Today the RemoteObject.value field is typed as String, but can be other primitive or JSON values. This results in a runtime exception when accessing the value.

A simple repro is something like this:

var result = await connection.runtime.evaluate('1 == 1;');
print(result.value);

This results in an exception like the following:

type 'bool' is not a subtype of type 'String'
package:webkit_inspection_protocol/src/runtime.dart 210:23  RemoteObject.value

get chromedriver tests running

The results from the last attempt:

Starting ChromeDriver 100.0.4896.60 (6a5d10861ce8de5fce22564658033b43cb7de047-refs/branch-heads/4896@{#875}) on port 4444
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.

✅ test/console_test.dart: WipConsole receives new console messages
❌ test/console_test.dart: WipConsole receives old console messages (failed)
❌ test/console_test.dart: WipConsole does not receive messages if not enabled (failed)
✅ test/runtime_test.dart: WipRuntime getIsolateId
❌ test/runtime_test.dart: WipRuntime getHeapUsage (failed)
❌ test/runtime_test.dart: WipRuntime evaluate (failed)
❌ test/runtime_test.dart: WipRuntime callFunctionOn (failed)
✅ test/runtime_test.dart: WipRuntime getProperties
✅ test/debugger_test.dart: WipDebugger gets script events
❌ test/debugger_test.dart: WipDebugger getScriptSource (failed)
✅ test/debugger_test.dart: WipDebugger getPossibleBreakpoints
❌ test/debugger_test.dart: WipDebugger setBreakpoint / removeBreakpoint (failed)
✅ test/dom_model_test.dart: WipDomModel maintains model across getDocument calls
❌ test/dom_model_test.dart: WipDomModel requestChildNodes updates children (failed)
✅ test/dom_model_test.dart: WipDomModel removing a node updates children
❎ test/dom_model_test.dart: WipDomModel Moving a node updates children (skipped)
✅ test/dom_model_test.dart: WipDomModel Setting node value updates value
✅ test/dom_model_test.dart: WipDomModel Adding attribute updates attributes
❌ test/dom_model_test.dart: WipDomModel Changing attribute updates attributes (failed)
❌ test/dom_model_test.dart: WipDomModel Removing attribute updates attributes (failed)
❌ test/dom_model_test.dart: WipDomModel refreshing resets document (failed)
❎ test/dom_model_test.dart: WipDomModel getting attributes works (skipped)

Error: 9 tests passed, 11 failed, 2 skipped.

renaming the default branch to `main`

As a heads up, we'll be renaming the default branch fro this repo to main. People with existing clones update them via can:

git branch -m master main
git fetch origin
git branch -u origin/main main
git remote set-head origin -a

tests are flaky

The tests are flaky; w/ issues generally around connecting to the chrome driver instance. Perhaps we need to have a small delay between tests to allow the chrome driver to cycle itself?

Page.reload doesn't work

The local params variable needs to be explicitly typed as a <String, dynamic>{}.

_InternalLinkedHashMap<dynamic, dynamic>' is not a subtype of type 'Map<String, dynamic>'
#0      WipPage.reload (package:webkit_inspection_protocol/src/page.dart:28:47)

Bonus points for disabling implicit casts to catch other similar errors.

Report reason for exit and errors in web connection

Original issue: flutter/flutter#99157

We are seeing some web connections closing right after the start of debugging with no error messages (see the verbose logs in the issue above).

Would it be possible to

  • add onError handler to the web socket the web connection is using, and report those errors to the caller (maybe the error handler can be passed to the constructor):

  • report the reason for exiting?

dwds caller
dwds just stops debugging when the connection is closed, and is not aware of the reason:

https://github.com/dart-lang/webdev/blob/8c814f9d89915418d8abe354ff9befec8f2906b2/dwds/lib/src/handlers/dev_handler.dart#L241
https://github.com/dart-lang/webdev/blob/8c814f9d89915418d8abe354ff9befec8f2906b2/dwds/lib/src/handlers/dev_handler.dart#L527

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.