Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
bb5c3400
Unverified
Commit
bb5c3400
authored
Apr 01, 2020
by
Jonah Williams
Committed by
GitHub
Apr 01, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] cache the base URL as index.html (#53666)
parent
d62c7ecc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
0 deletions
+19
-0
web.dart
packages/flutter_tools/lib/src/build_system/targets/web.dart
+4
-0
web_test.dart
...ols/test/general.shard/build_system/targets/web_test.dart
+15
-0
No files found.
packages/flutter_tools/lib/src/build_system/targets/web.dart
View file @
bb5c3400
...
...
@@ -354,6 +354,10 @@ class WebServiceWorker extends Target {
).
toString
();
final
String
hash
=
md5
.
convert
(
await
file
.
readAsBytes
()).
toString
();
urlToHash
[
url
]
=
hash
;
// Add an additional entry for the base URL.
if
(
globals
.
fs
.
path
.
basename
(
url
)
==
'index.html'
)
{
urlToHash
[
'/'
]
=
hash
;
}
}
final
File
serviceWorkerFile
=
environment
.
outputDir
...
...
packages/flutter_tools/test/general.shard/build_system/targets/web_test.dart
View file @
bb5c3400
...
...
@@ -462,6 +462,21 @@ void main() {
// Depends on resource file.
expect
(
environment
.
buildDir
.
childFile
(
'service_worker.d'
).
readAsStringSync
(),
contains
(
'a/a.txt'
));
}));
test
(
'WebServiceWorker contains baseUrl cache'
,
()
=>
testbed
.
run
(()
async
{
environment
.
outputDir
.
childFile
(
'index.html'
)
.
createSync
(
recursive:
true
);
await
const
WebServiceWorker
().
build
(
environment
);
expect
(
environment
.
outputDir
.
childFile
(
'flutter_service_worker.js'
),
exists
);
// Contains file hash for both `/` and index.html.
expect
(
environment
.
outputDir
.
childFile
(
'flutter_service_worker.js'
).
readAsStringSync
(),
contains
(
'"/": "d41d8cd98f00b204e9800998ecf8427e"'
));
expect
(
environment
.
outputDir
.
childFile
(
'flutter_service_worker.js'
).
readAsStringSync
(),
contains
(
'"index.html": "d41d8cd98f00b204e9800998ecf8427e"'
));
expect
(
environment
.
buildDir
.
childFile
(
'service_worker.d'
),
exists
);
}));
}
class
MockProcessManager
extends
Mock
implements
ProcessManager
{}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment