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 de6730d commit 899b5e4
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 @@ -3,6 +3,32 @@ use
strict
"
;
ChromeUtils
.
defineESModuleGetters
(
this
{
UrlbarTestUtils
:
"
resource
:
/
/
testing
-
common
/
UrlbarTestUtils
.
sys
.
mjs
"
}
)
;
let
TEST_PATH
=
Expand Down Expand Up @@ -289,7 +315,12 @@ window
gURLBar
.
value
UrlbarTestUtils
.
trimURL
(
AUTH_URL
)
"
Correct
location
Expand Down Expand Up @@ -356,6 +387,10 @@ window
gURLBar
.
value
UrlbarTestUtils
.
trimURL
(
"
https
:
Expand All @@ -365,6 +400,7 @@ example
.
org
"
)
"
No
location
Expand Down Expand Up @@ -421,7 +457,12 @@ window
gURLBar
.
value
UrlbarTestUtils
.
trimURL
(
AUTH_URL
)
"
Correct
location
Expand Down Expand Up @@ -522,7 +563,12 @@ window
gURLBar
.
value
UrlbarTestUtils
.
trimURL
(
AUTH_URL
)
"
Correct
location
Expand Down Expand Up @@ -575,7 +621,12 @@ window
gURLBar
.
value
UrlbarTestUtils
.
trimURL
(
CROSS_DOMAIN_URL
)
"
No
location
Expand Down Expand Up @@ -658,7 +709,12 @@ window
gURLBar
.
value
UrlbarTestUtils
.
trimURL
(
SAME_DOMAIN_URL
)
"
No
location
Expand Down Expand Up @@ -798,11 +854,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 @@ -3,6 +3,32 @@ use
strict
"
;
const
{
UrlbarTestUtils
}
=
ChromeUtils
.
importESModule
(
"
resource
:
/
/
testing
-
common
/
UrlbarTestUtils
.
sys
.
mjs
"
)
;
let
TEST_PATH
=
Expand Down Expand Up @@ -235,7 +261,12 @@ equal
gURLBar
.
value
UrlbarTestUtils
.
trimURL
(
AUTH_URL
)
"
url
bar
Expand Down Expand Up @@ -270,7 +301,12 @@ focus
let
endOfSelectionRange
=
UrlbarTestUtils
.
trimURL
(
AUTH_URL
)
.
indexOf
(
Expand All @@ -284,6 +320,20 @@ sjs
"
)
;
let
isProtocolTrimmed
=
AUTH_URL
.
startsWith
(
UrlbarTestUtils
.
getTrimmedProtocolWithSlashes
(
)
)
;
await
SimpleTest
.
Expand All @@ -295,6 +345,20 @@ substring
(
0
endOfSelectionRange
+
(
isProtocolTrimmed
?
UrlbarTestUtils
.
getTrimmedProtocolWithSlashes
(
)
.
length
:
0
)
)
(
)
Expand All @@ -308,7 +372,12 @@ equal
gURLBar
.
value
UrlbarTestUtils
.
trimURL
(
AUTH_URL
)
"
url
bar
Expand Down Expand Up @@ -378,7 +447,12 @@ window
gURLBar
.
value
UrlbarTestUtils
.
trimURL
(
CROSS_DOMAIN_URL
)
"
No
location
Expand Down Expand Up @@ -414,7 +488,12 @@ equal
gURLBar
.
value
UrlbarTestUtils
.
trimURL
(
CROSS_DOMAIN_URL
)
"
url
bar
Expand Down Expand Up @@ -449,6 +528,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 899b5e4

Please sign in to comment.