New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 626321 link

Starred by 26 users

Issue metadata

Status: Fixed
Owner:
Closed: Nov 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Android , Windows , Chrome , Mac
Pri: 3
Type: Launch-OWP
Launch-Accessibility: ----
Launch-Exp-Leadership: ----
Launch-Leadership: ----
Launch-Legal: ----
Launch-M-Approved: ----
Launch-M-Target: ----
Launch-Privacy: ----
Launch-Security: ----
Launch-Test: ----
Launch-UI: ----
Rollout-Type: ----



Sign in to add a comment

Remove preloading scripts with invalid type/language attributes

Project Member Reported by csharrison@chromium.org, Jul 7 2016

Issue description

Change description:
Stop preloading scripts that wouldn't have been loaded anyways due to type/language attributes.

Changes to API surface:
None

Support in other browsers:
Internet Explorer: Unsure
Firefox: Scripts are preloaded regardless of type/language
Safari: Scripts are preloaded regardless of type/language, as long as the preload scanner is run (parser blocked on script).
 
Description: Show this description
Cc: sim...@opera.com csharrison@chromium.org
 Issue 626205  has been merged into this issue.
Labels: -M-54 M-56
M56 branch point is in 2 weeks and this has a removal warning in Deprecation.cpp. Checking in to see if we are still on track for removal in M56?
Cc: cfredric@chromium.org
 Issue 662085  has been merged into this issue.
Owner: cfredric@chromium.org
Yes we are on track for removal. cfredric is working on the CL right now.
Project Member

Comment 8 by bugdroid1@chromium.org, Nov 10 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/f76c6bc7e8fa6e1ca60101ab3dfc35ba7a40594c

commit f76c6bc7e8fa6e1ca60101ab3dfc35ba7a40594c
Author: cfredric <cfredric@chromium.org>
Date: Thu Nov 10 17:01:57 2016

Stop preloading scripts that have invalid type/language attributes

This patch removes prefetching of scripts that have invalid type/language
attributes, and removes the deprecation warning. This also adds/edits tests
accordingly.

BUG= 626321 

Review-Url: https://codereview.chromium.org/2479703003
Cr-Commit-Position: refs/heads/master@{#431277}

[modify] https://crrev.com/f76c6bc7e8fa6e1ca60101ab3dfc35ba7a40594c/third_party/WebKit/LayoutTests/fast/dom/HTMLScriptElement/dont-load-unknown-type-expected.txt
[modify] https://crrev.com/f76c6bc7e8fa6e1ca60101ab3dfc35ba7a40594c/third_party/WebKit/LayoutTests/fast/dom/HTMLScriptElement/dont-load-unknown-type.html
[modify] https://crrev.com/f76c6bc7e8fa6e1ca60101ab3dfc35ba7a40594c/third_party/WebKit/Source/core/frame/Deprecation.cpp
[modify] https://crrev.com/f76c6bc7e8fa6e1ca60101ab3dfc35ba7a40594c/third_party/WebKit/Source/core/frame/UseCounter.h
[modify] https://crrev.com/f76c6bc7e8fa6e1ca60101ab3dfc35ba7a40594c/third_party/WebKit/Source/core/html/parser/HTMLPreloadScanner.cpp
[modify] https://crrev.com/f76c6bc7e8fa6e1ca60101ab3dfc35ba7a40594c/third_party/WebKit/Source/core/html/parser/HTMLPreloadScannerTest.cpp
[modify] https://crrev.com/f76c6bc7e8fa6e1ca60101ab3dfc35ba7a40594c/third_party/WebKit/Source/core/html/parser/HTMLResourcePreloader.cpp
[modify] https://crrev.com/f76c6bc7e8fa6e1ca60101ab3dfc35ba7a40594c/third_party/WebKit/Source/core/html/parser/PreloadRequest.h

Status: Fixed (was: Assigned)
Cc: ranjitkan@chromium.org kouhei@chromium.org japhet@chromium.org hirosh...@chromium.org
 Issue 623109  has been merged into this issue.
Cc: rbyers@chromium.org zcorpan@gmail.com tkonch...@chromium.org
 Issue 329531  has been merged into this issue.
I am developer and ... dev tools tell me your broke my browser w/ this. Ex:
https://cekvenich.site44.com/home/home/
and open developer tools.
I get warning:
Fetching scripts with an invalid type/language attributes is deprecated and will be removed in M56, around January 2017. See https://www.chromestatus.com/features/5760718284521472 for more details.

1:  And it says you plan to plan to stop some scripts work next month.
2:  Also: it won't say what scripts.  Or what line. (maybe some lib I'm using even.)
3: If you view source - all my scripts do have a type.
That 3rd point is important. What is the issue here at all? Google search won't help.
You are removing something, fine. But in English, are your removing?

So how can I fix my sites?
Or help w/ 1, 2, and 3, please. 
1. We will only stop preloading the scripts. Usually this will not break scripts with custom types because libraries which do this often do their own fetching using things like XMLHttpRequest or fetch().

2. You have scripts with type="riot/tag" in your markup, which is not a valid type for <script> I'm not sure what they are used for, but at least we will stop *preloading* e.g. /_compHost/home-card.tag. In fact, for your app this improves performance, because you load these with XHR, but the browser (before this change) makes a *second* fetch for the resource expecting it to be Javascript. This wastes bytes.

3. To load the script, you must have a *valid* type (e.g. "javascript"). You can look at [1] to see valid types. You can also set it blank.

[1] https://html.spec.whatwg.org/multipage/scripting.html#javascript-mime-type

Please let me know if you have any questions. I agree the deprecation message could be a bit clearer. Sorry about that :/
In short, you don't have to worry.

The warnings are from <script type="riot/tag">s which are non-standard.
While we stop speculative prefetching of those files, they are still fetched with XHRs issued from riot.js and should work just fine.

Comment 15 by zcorpan@gmail.com, Dec 7 2016

I filed https://github.com/riot/riot/issues/2140 "Do not use <script type="riot/tag" src="...">"
Thanks zcorpan!
What will happen if the MIME type of the script is not set at all? All examples and discussion seem to be about decent MIME types but not about missing MIME type.

Thank you for your help!
@17 If the type attribute is missing, it will default to "text/javascript"
acmesquares@ is exactly right, see #6 of the "prepare a script" algorithm:
https://html.spec.whatwg.org/multipage/scripting.html#prepare-a-script

Comment 20 by zcorpan@gmail.com, Dec 13 2016

With riot 3.0.3, web developers can use data-src instead of src to avoid this issue in current Chrome (and other browsers).

https://github.com/riot/riot/commit/83043f1afa331aa2c6240b895fb277fe24f8ab23

Comment 21 by zcorpan@gmail.com, Dec 14 2016

I meant 3.0.4
acmesquares and csharrison: Thank you for your precise and helpful answers.

Comment 23 by bruno...@gmail.com, Dec 18 2016

I'm using `text/babel` with `<script type="text/javascript" src="http://www.jimsproch.com/react/babel-browser.js"></script>`.

Will it still work?
This change should not break babel-browser.js, which uses standard XHR to fetch scripts with type='text/babel'.
Owner: csharrison@chromium.org
 Issue 679914  has been merged into this issue.

Sign in to add a comment