Skip to content

Commit

Permalink
Bug 1853418 - Prepare tab-related tests.r=dao
Browse files Browse the repository at this point in the history
Differential Revision: https://phabricator.services.mozilla.com/D190555

UltraBlame original commit: 1a42179c6b78749c0c13e4494bb5523662fe91a0
  • Loading branch information
marco-c committed Oct 18, 2023
1 parent c08e3f6 commit 094a0d1
Show file tree
Hide file tree
Showing 7 changed files with 590 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,32 @@ use
strict
"
;
ChromeUtils
.
defineESModuleGetters
(
this
{
UrlbarTestUtils
:
"
resource
:
/
/
testing
-
common
/
UrlbarTestUtils
.
sys
.
mjs
"
}
)
;
let
TEST_PATH
=
Expand Down Expand Up @@ -436,7 +462,12 @@ window
gURLBar
.
value
UrlbarTestUtils
.
trimURL
(
AUTH_URL
)
"
Correct
location
Expand Down Expand Up @@ -524,6 +555,10 @@ window
gURLBar
.
value
UrlbarTestUtils
.
trimURL
(
"
https
:
Expand All @@ -533,6 +568,7 @@ example
.
org
"
)
"
No
location
Expand Down Expand Up @@ -612,7 +648,12 @@ window
gURLBar
.
value
UrlbarTestUtils
.
trimURL
(
AUTH_URL
)
"
Correct
location
Expand Down Expand Up @@ -759,7 +800,12 @@ window
gURLBar
.
value
UrlbarTestUtils
.
trimURL
(
AUTH_URL
)
"
Correct
location
Expand Down Expand Up @@ -821,7 +867,12 @@ window
gURLBar
.
value
UrlbarTestUtils
.
trimURL
(
CROSS_DOMAIN_URL
)
"
No
location
Expand Down Expand Up @@ -908,7 +959,12 @@ window
gURLBar
.
value
UrlbarTestUtils
.
trimURL
(
SAME_DOMAIN_URL
)
"
No
location
Expand Down Expand Up @@ -1112,11 +1168,16 @@ window
gURLBar
.
value
UrlbarTestUtils
.
trimURL
(
crossDomain
?
CROSS_DOMAIN_URL
:
SAME_DOMAIN_URL
)
"
No
location
Expand Down
154 changes: 154 additions & 0 deletions browser/base/content/test/tabPrompts/browser_auth_spoofing_url_copy.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,32 @@ use
strict
"
;
const
{
UrlbarTestUtils
}
=
ChromeUtils
.
importESModule
(
"
resource
:
/
/
testing
-
common
/
UrlbarTestUtils
.
sys
.
mjs
"
)
;
let
TEST_PATH
=
Expand Down Expand Up @@ -305,7 +331,12 @@ equal
gURLBar
.
value
UrlbarTestUtils
.
trimURL
(
AUTH_URL
)
"
url
bar
Expand Down Expand Up @@ -348,7 +379,12 @@ focus
let
endOfSelectionRange
=
UrlbarTestUtils
.
trimURL
(
AUTH_URL
)
.
indexOf
(
Expand All @@ -362,6 +398,20 @@ sjs
"
)
;
let
isProtocolTrimmed
=
AUTH_URL
.
startsWith
(
UrlbarTestUtils
.
getTrimmedProtocolWithSlashes
(
)
)
;
await
SimpleTest
.
Expand All @@ -373,6 +423,20 @@ substring
(
0
endOfSelectionRange
+
(
isProtocolTrimmed
?
UrlbarTestUtils
.
getTrimmedProtocolWithSlashes
(
)
.
length
:
0
)
)
(
)
Expand All @@ -386,7 +450,12 @@ equal
gURLBar
.
value
UrlbarTestUtils
.
trimURL
(
AUTH_URL
)
"
url
bar
Expand Down Expand Up @@ -456,7 +525,12 @@ window
gURLBar
.
value
UrlbarTestUtils
.
trimURL
(
CROSS_DOMAIN_URL
)
"
No
location
Expand Down Expand Up @@ -504,7 +578,12 @@ equal
gURLBar
.
value
UrlbarTestUtils
.
trimURL
(
CROSS_DOMAIN_URL
)
"
url
bar
Expand Down Expand Up @@ -563,6 +642,81 @@ testUrlCopy
(
)
{
SpecialPowers
.
pushPrefEnv
(
{
set
:
[
[
"
browser
.
urlbar
.
trimHttps
"
false
]
[
"
browser
.
urlbar
.
trimURLs
"
true
]
]
}
)
;
await
trigger401AndHandle
(
)
;
SpecialPowers
.
popPrefEnv
(
)
;
SpecialPowers
.
pushPrefEnv
(
{
set
:
[
[
"
browser
.
urlbar
.
trimHttps
"
true
]
[
"
browser
.
urlbar
.
trimURLs
"
true
]
]
}
)
;
await
trigger401AndHandle
(
Expand Down
Loading

0 comments on commit 094a0d1

Please sign in to comment.