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
a7011c48
Unverified
Commit
a7011c48
authored
Mar 17, 2020
by
Jonah Williams
Committed by
GitHub
Mar 17, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] don't force service worker cache files to be absolute (#52606)
parent
69fbbef2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
14 deletions
+22
-14
index.html
dev/integration_tests/flutter_gallery/web/index.html
+4
-4
web.dart
packages/flutter_tools/lib/src/build_system/targets/web.dart
+17
-9
web_test.dart
...ols/test/general.shard/build_system/targets/web_test.dart
+1
-1
No files found.
dev/integration_tests/flutter_gallery/web/index.html
View file @
a7011c48
...
...
@@ -12,11 +12,11 @@ found in the LICENSE file. -->
<meta
name=
"apple-mobile-web-app-capable"
content=
"yes"
>
<meta
name=
"apple-mobile-web-app-status-bar-style"
content=
"black"
>
<meta
name=
"apple-mobile-web-app-title"
content=
"Flutter Gallery"
>
<link
rel=
"apple-touch-icon"
href=
"
/
icons/Icon-192.png"
>
<link
rel=
"shortcut icon"
type=
"image/png"
href=
"
/
favicon.png"
/>
<link
rel=
"apple-touch-icon"
href=
"icons/Icon-192.png"
>
<link
rel=
"shortcut icon"
type=
"image/png"
href=
"favicon.png"
/>
<title>
Flutter Gallery
</title>
<link
rel=
"manifest"
href=
"
/
manifest.json"
>
<link
rel=
"manifest"
href=
"manifest.json"
>
</head>
<body>
<!-- This script installs service_worker.js to provide PWA functionality to
...
...
@@ -25,7 +25,7 @@ found in the LICENSE file. -->
<script>
if
(
'serviceWorker'
in
navigator
)
{
window
.
addEventListener
(
'load'
,
function
()
{
navigator
.
serviceWorker
.
register
(
'
/
flutter_service_worker.js'
);
navigator
.
serviceWorker
.
register
(
'flutter_service_worker.js'
);
});
}
</script>
...
...
packages/flutter_tools/lib/src/build_system/targets/web.dart
View file @
a7011c48
...
...
@@ -340,18 +340,26 @@ class WebServiceWorker extends Target {
.
where
((
File
file
)
=>
!
file
.
path
.
endsWith
(
'flutter_service_worker.js'
)
&&
!
globals
.
fs
.
path
.
basename
(
file
.
path
).
startsWith
(
'.'
))
.
toList
();
// TODO(jonahwilliams): determine whether this needs to be made more efficient.
final
Map
<
String
,
String
>
uriToHash
=
<
String
,
String
>{
for
(
File
file
in
contents
)
// Do not force caching of source maps.
if
(!
file
.
path
.
endsWith
(
'main.dart.js.map'
))
'/
${globals.fs.path.toUri(globals.fs.path.relative(file.path, from: environment.outputDir.path)).toString()}
'
:
md5
.
convert
(
await
file
.
readAsBytes
()).
toString
(),
};
final
Map
<
String
,
String
>
urlToHash
=
<
String
,
String
>{};
for
(
final
File
file
in
contents
)
{
// Do not force caching of source maps.
if
(
file
.
path
.
endsWith
(
'main.dart.js.map'
))
{
continue
;
}
final
String
url
=
globals
.
fs
.
path
.
toUri
(
globals
.
fs
.
path
.
relative
(
file
.
path
,
from:
environment
.
outputDir
.
path
),
).
toString
();
final
String
hash
=
md5
.
convert
(
await
file
.
readAsBytes
()).
toString
();
urlToHash
[
url
]
=
hash
;
}
final
File
serviceWorkerFile
=
environment
.
outputDir
.
childFile
(
'flutter_service_worker.js'
);
final
Depfile
depfile
=
Depfile
(
contents
,
<
File
>[
serviceWorkerFile
]);
final
String
serviceWorker
=
generateServiceWorker
(
ur
i
ToHash
);
final
String
serviceWorker
=
generateServiceWorker
(
ur
l
ToHash
);
serviceWorkerFile
.
writeAsStringSync
(
serviceWorker
);
final
DepfileService
depfileService
=
DepfileService
(
...
...
packages/flutter_tools/test/general.shard/build_system/targets/web_test.dart
View file @
a7011c48
...
...
@@ -452,7 +452,7 @@ void main() {
expect
(
environment
.
outputDir
.
childFile
(
'flutter_service_worker.js'
),
exists
);
// Contains file hash.
expect
(
environment
.
outputDir
.
childFile
(
'flutter_service_worker.js'
).
readAsStringSync
(),
contains
(
'"
/
a/a.txt": "7fc56270e7a70fa81a5935b72eacbe29"'
));
contains
(
'"a/a.txt": "7fc56270e7a70fa81a5935b72eacbe29"'
));
expect
(
environment
.
buildDir
.
childFile
(
'service_worker.d'
),
exists
);
// Depends on resource file.
expect
(
environment
.
buildDir
.
childFile
(
'service_worker.d'
).
readAsStringSync
(),
contains
(
'a/a.txt'
));
...
...
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