-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dev tools Network and Performance (#7212)
Expose CDP primitives for Network and Performance domains.
- Loading branch information
Showing
72 changed files
with
7,068 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<html> | ||
<body> | ||
|
||
<form method="post" action="resultPage.html"> | ||
<select id="redirect" name="redirect" onchange="javascript:changePage();"> | ||
<option selected="selected" value="one">One</option> | ||
<option id="changeme" value="two">Two</option> | ||
</select> | ||
|
||
<input type="submit" /> | ||
</form> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
611 changes: 611 additions & 0 deletions
611
java/client/src/org/openqa/selenium/devtools/network/Network.java
Large diffs are not rendered by default.
Oops, something went wrong.
105 changes: 105 additions & 0 deletions
105
java/client/src/org/openqa/selenium/devtools/network/model/AuthChallenge.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
// Licensed to the Software Freedom Conservancy (SFC) under one | ||
// or more contributor license agreements. See the NOTICE file | ||
// distributed with this work for additional information | ||
// regarding copyright ownership. The SFC licenses this file | ||
// to you under the Apache License, Version 2.0 (the | ||
// "License"); you may not use this file except in compliance | ||
// with the License. You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, | ||
// software distributed under the License is distributed on an | ||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
// KIND, either express or implied. See the License for the | ||
// specific language governing permissions and limitations | ||
// under the License. | ||
|
||
package org.openqa.selenium.devtools.network.model; | ||
|
||
import static java.util.Objects.requireNonNull; | ||
|
||
import org.openqa.selenium.json.JsonInput; | ||
|
||
public class AuthChallenge { | ||
|
||
/** | ||
* Origin of the challenger. | ||
*/ | ||
private String origin; | ||
/** | ||
* The realm of the challenge. May be empty. | ||
*/ | ||
private String realm; | ||
/** | ||
* The authentication scheme used, such as basic or digest | ||
*/ | ||
private String scheme; | ||
/** | ||
* Source of the authentication challenge. | ||
* Optional | ||
*/ | ||
private Source source; | ||
|
||
public static AuthChallenge parseRequest(JsonInput input) { | ||
AuthChallenge authChallenge = new AuthChallenge(); | ||
input.beginObject(); | ||
while (input.hasNext()){ | ||
switch (input.nextName()) { | ||
case "origin" : | ||
authChallenge.setOrigin(input.nextString()); | ||
break; | ||
case "realm" : | ||
authChallenge.setRealm(input.nextString()); | ||
break; | ||
case "scheme" : | ||
authChallenge.setScheme(input.nextString()); | ||
break; | ||
case "source" : | ||
authChallenge.setSource(Source.getSource(input.nextString())); | ||
break; | ||
default: | ||
input.skipValue(); | ||
break; | ||
} | ||
} | ||
input.endObject(); | ||
return authChallenge; | ||
} | ||
|
||
|
||
public String getScheme() { | ||
return scheme; | ||
} | ||
|
||
private void setScheme(String scheme) { | ||
requireNonNull(origin, "'scheme' is mandatory for AuthChallenge"); | ||
this.scheme = scheme; | ||
} | ||
|
||
public String getOrigin() { | ||
return origin; | ||
} | ||
|
||
public void setOrigin(String origin) { | ||
requireNonNull(origin, "'origin' is mandatory for AuthChallenge"); | ||
this.origin = origin; | ||
} | ||
|
||
public String getRealm() { | ||
return realm; | ||
} | ||
|
||
private void setRealm(String realm) { | ||
requireNonNull(origin, "'realm' is mandatory for AuthChallenge"); | ||
this.realm = realm; | ||
} | ||
|
||
public Source getSource() { | ||
return source; | ||
} | ||
|
||
public void setSource(Source source) { | ||
this.source = source; | ||
} | ||
} |
78 changes: 78 additions & 0 deletions
78
java/client/src/org/openqa/selenium/devtools/network/model/AuthChallengeResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
// Licensed to the Software Freedom Conservancy (SFC) under one | ||
// or more contributor license agreements. See the NOTICE file | ||
// distributed with this work for additional information | ||
// regarding copyright ownership. The SFC licenses this file | ||
// to you under the Apache License, Version 2.0 (the | ||
// "License"); you may not use this file except in compliance | ||
// with the License. You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, | ||
// software distributed under the License is distributed on an | ||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
// KIND, either express or implied. See the License for the | ||
// specific language governing permissions and limitations | ||
// under the License. | ||
|
||
package org.openqa.selenium.devtools.network.model; | ||
|
||
import java.util.Objects; | ||
|
||
/** | ||
* Response to an AuthChallenge | ||
*/ | ||
public class AuthChallengeResponse { | ||
|
||
/** | ||
* The decision on what to do in response to the authorization challenge. Default means deferring to the default behavior of the net stack, | ||
* which will likely either the Cancel authentication or display a popup dialog box | ||
*/ | ||
private final String response; | ||
|
||
/** | ||
* The username to provide, possibly empty. Should only be set if response is ProvideCredentials | ||
*/ | ||
private final String username; | ||
|
||
/** | ||
* The password to provide, possibly empty. Should only be set if response is ProvideCredentials | ||
*/ | ||
private final String password; | ||
|
||
public AuthChallengeResponse(String response, String username, String password) { | ||
this.response = Objects.requireNonNull(response, "response must be set."); | ||
this.username = username; | ||
this.password = password; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) { | ||
return true; | ||
} | ||
if (o == null || getClass() != o.getClass()) { | ||
return false; | ||
} | ||
AuthChallengeResponse that = (AuthChallengeResponse) o; | ||
return Objects.equals(response, that.response) && | ||
Objects.equals(username, that.username) && | ||
Objects.equals(password, that.password); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
|
||
return Objects.hash(response, username, password); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "AuthChallengeResponse{" + | ||
"response='" + response + '\'' + | ||
", username='" + username + '\'' + | ||
", password='" + password + '\'' + | ||
'}'; | ||
} | ||
|
||
} |
53 changes: 53 additions & 0 deletions
53
java/client/src/org/openqa/selenium/devtools/network/model/BlockedReason.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// Licensed to the Software Freedom Conservancy (SFC) under one | ||
// or more contributor license agreements. See the NOTICE file | ||
// distributed with this work for additional information | ||
// regarding copyright ownership. The SFC licenses this file | ||
// to you under the Apache License, Version 2.0 (the | ||
// "License"); you may not use this file except in compliance | ||
// with the License. You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, | ||
// software distributed under the License is distributed on an | ||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
// KIND, either express or implied. See the License for the | ||
// specific language governing permissions and limitations | ||
// under the License. | ||
|
||
package org.openqa.selenium.devtools.network.model; | ||
|
||
/** | ||
* The reason why request was blocked | ||
*/ | ||
public enum BlockedReason { | ||
|
||
other("other"), | ||
csp("csp"), | ||
mixedContent("mixed-content"), | ||
origin("origin"), | ||
inspector("inspector"), | ||
subresourceFilter("subresource-filter"), | ||
contentType("content-type"), | ||
collapsedbyClient("collapsed-by-client"); | ||
|
||
private String reason; | ||
|
||
BlockedReason(String reason) { | ||
this.reason = reason; | ||
} | ||
|
||
public String getReason() { | ||
return reason; | ||
} | ||
|
||
public static BlockedReason fromString(String s) { | ||
for (BlockedReason b : BlockedReason.values()) { | ||
if (b.getReason().equalsIgnoreCase(s)) { | ||
return b; | ||
} | ||
} | ||
return null; | ||
} | ||
|
||
} |
Oops, something went wrong.