Code Monkey home page Code Monkey logo

sw-test's Introduction

sw-test's People

Contributors

anovsiradj avatar chrisdavidmills avatar cvan avatar darker avatar davidnguyen11 avatar jeromeetienne avatar jrburke avatar juliandescottes avatar kenju avatar mozilla-github-standards avatar mrxcray avatar qgustavor avatar rumyra avatar simonsiefke avatar wanderview avatar wbamberg avatar zunino avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sw-test's Issues

python -m http.server leads to a SecurityError due to bad content types

Using python -m http.server 8001 with Python 3.7 on Windows 10 to start a simple server as described will result in the following message printed on to the console in Firefox 74.0:
Registration failed with SecurityError: The operation is insecure.

Using Chrome, you can get the following additional information:
Registration failed with SecurityError: Failed to register a ServiceWorker for scope ('http://localhost:8001/sw-test/') with script ('http://localhost:8001/sw-test/sw.js'): The script has an unsupported MIME type ('text/plain').

It seems like the Python http.server module is unable to use the correct mimetypes in the HTTP response for JavaScript files. Also, the content types of the other JavaScript files are text/plain as well in the HTTP response, as for example in the response of app.js:

HTTP/1.0 200 OK
Server: SimpleHTTP/0.6 Python/3.7.4
Date: Thu, 19 Mar 2020 19:27:39 GMT
Content-type: text/plain
Content-Length: 2143
Last-Modified: Thu, 19 Mar 2020 19:24:15 GMT

The content types of the JPEG images seem to be okay.

If you experience the same problem, starting a server using the Python script at https://gist.github.com/HaiyangXu/ec88cbdce3cdbac7b8d5 works for me.

Why cloning the response in sw-test/sw.js?

This isn't a real issue but more a question about your service worker: why would you need to clone the response on line 28? I would have written it like this:

.then(function(response) {
	caches.open('v1').then(function(cache) {
		cache.put(event.request, response);
	});
	return response;
})

Any thoughts about this?

Service worker installation fails due to 404 on /sw-test/gallery/

In https://github.com/mdn/sw-test/blob/gh-pages/sw.js, the call to cache.addAll() throws an exception when trying to add /sw-test/gallery to the cache. Link is a 404, and responses with an error type are not supported by cache.add methods.

This forces the service worker installation to fail on Firefox (which is correct according to the current specs: https://slightlyoff.github.io/ServiceWorker/spec/service_worker/#installation-algorithm).

CODE_OF_CONDUCT.md file missing

As of January 1 2019, Mozilla requires that all GitHub projects include this CODE_OF_CONDUCT.md file in the project root. The file has two parts:

  1. Required Text - All text under the headings Community Participation Guidelines and How to Report, are required, and should not be altered.
  2. Optional Text - The Project Specific Etiquette heading provides a space to speak more specifically about ways people can work effectively and inclusively together. Some examples of those can be found on the Firefox Debugger project, and Common Voice. (The optional part is commented out in the raw template file, and will not be visible until you modify and uncomment that part.)

If you have any questions about this file, or Code of Conduct policies and procedures, please see Mozilla-GitHub-Standards or email [email protected].

(Message COC001)

Failed to register a ServiceWorker Issue

Hello, keep getting the following in the console, even after deploying to https and enabling experimental web platform features: Registration failed with TypeError: Failed to register a ServiceWorker: A bad HTTP response code (404) was received when fetching the script.

Here is the site: https://jaysonvdw.github.io/

Please assist

Dynamic content blocked by SW

I have dynamic content which one change something on website like number of sold items. I'm displaying number of orders on web page based on database connection. When number change I don't see this updated content and after second time reload page updated number is show. For example if customers see number 0 of orders and another customer order item then first one which one seen 0 at first visit next time he will see again 0 order even if real counter will be much higher than 0 because he get cached website from first visit. This Service Worker is maybe good for static context not for dynamical. Is there any way to disable caching DIV content?

localhost

OS: Linux Fedora
Chrome: Version 75.0.3770.100 (Official Build) (64-bit)
Python 2

Ran...
python -m SimpleHTTPServer 8001
chrome: http://localhost:8001/sw-test/

Didn't work.

I removed the "/sw-test/" from the URL and it at least loaded the demo.
Still got 404 error for the service worker.

In app.js I edited line 4 to remove /sw-test/ from the URI and then the slashes from 'scope'.
navigator.serviceWorker.register('sw.js', { scope: 'sw-test' }).then(function (reg) {

In sw.js I edited lines 5 - 12 to remove the '/sw-test/':
'index.html', 'style.css', 'app.js', 'image-list.js', 'star-wars-logo.jpg', 'gallery/bountyHunters.jpg', 'gallery/myLittleVader.jpg', 'gallery/snowTroopers.jpg'

After those edits it worked.

Readme mentioning HTTPS requirement would be useful

I couldn't make service workers work. Probably because I haven't figured out how to use HTTPS on my local development environment.

If this is the reason I couldn't make service workers work, it would be nice if a readme could mention this requirement.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.