Skip to content

Conversation

@beatchristen
Copy link
Contributor

Hi @deviantintegral
I'm interested also in the non-standard attributes that chrome devtools exports since around chrome 67 or so.

All new APIs should be covered by tests.

Copy link
Owner

@deviantintegral deviantintegral left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great! Thanks for contributing.

There's one typo that needs to be fixed for sure. Otherwise, what do you think about adding a fixture that includes the initiator property? That would automatically be tested by https://github.com/deviantintegral/har/blob/master/tests/src/Unit/HarTest.php for the basic import / export case.

* @Serializer\Type("string")
*
* parser:
* Chrome's HTML parser.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this truly just Chrome, or any Blink-derived browser?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The expected values are from https://developers.google.com/web/tools/chrome-devtools/network/reference#requests
You are absolutely correct, all blink based browsers with devtools would use these values.

public function testHasInitiator()
{
// Initialize a repository of HAR files, with IDs being the file names.
$repository =
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo here? This looks like it's double-assigning the next variable.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indeed, the thought of moving stuff to setUp wasn't finished when I committed ;-)

@deviantintegral
Copy link
Owner

Looks like I didn't have the option to run CI on forks turned on. Your next commit should trigger them.

@beatchristen beatchristen force-pushed the chrome-devtools-_initiator-attributes branch from 09aa3d7 to 6a0df89 Compare February 12, 2021 15:29
public function testHasInitiator()
{
// Initialize a repository of HAR files, with IDs being the file names.
$repository =
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indeed, the thought of moving stuff to setUp wasn't finished when I committed ;-)

* @Serializer\Type("string")
*
* parser:
* Chrome's HTML parser.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The expected values are from https://developers.google.com/web/tools/chrome-devtools/network/reference#requests
You are absolutely correct, all blink based browsers with devtools would use these values.

return $this;
}

public function getUrl(): ?\Psr\Http\Message\UriInterface
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added nullability infos here.

@beatchristen
Copy link
Contributor Author

This looks great! Thanks for contributing.

There's one typo that needs to be fixed for sure. Otherwise, what do you think about adding a fixture that includes the initiator property? That would automatically be tested by https://github.com/deviantintegral/har/blob/master/tests/src/Unit/HarTest.php for the basic import / export case.

That's what I did at the beginning, but removeCustomFields() auto-fails via

 $a = array_filter($a, function ($key): bool { return !\is_string($key) || !(0 === strpos($key, '_')); }, \ARRAY_FILTER_USE_KEY); 

and putting JUST || '_initiator' == $key was a bit awkward.

Potentially, refactoring the current Serializer which is hardcoded in several places like HarTestBase, HarFileRepository could be split to a HarSpec12Serializer with the standard format compliance and a ChromiumBlinkDevToolsSerializer variant with all the latest bells and whistles.

That's however a topic for another issue, I think...

@deviantintegral
Copy link
Owner

Agreed on a new issue or pull request - I think that approach is a good idea, because it could also let us support future versions of HAR should they ever happen.

@deviantintegral deviantintegral merged commit 98dd32e into deviantintegral:master Feb 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants