rauchg / chrome-spdy-indicator

Chrome Extension to see an indicator of SPDY support in the address bar.
http://www.devthought.com/2012/03/10/chrome-spdy-indicator/
110 stars 22 forks source link

Deprecation of chrome.loadtimes() #38

Open kav2k opened 6 years ago

kav2k commented 6 years ago

The API this extension is built upon is being deprecated starting Chrome 64.

A rewrite is needed to use nextHopProtocol of Resource Timing Level 2 API.

tbroyer commented 6 years ago

Chrome 64 is out, meaning that everyone using this extension starts seeing deprecation warnings in the console.

image

cf. https://www.chromestatus.com/features/5637885046816768

Jxck commented 6 years ago

@rauchg I'm gathering Reporting endpoint from ReportingObserver on my service, and I got tons of DeprecationReport caused by this issue.

fixing are welcome !

rauchg commented 5 years ago

Let's fix!

Risgit commented 4 years ago

Fixing for Deprecation of chrome.loadtimes. \User Data\Default\Extensions\mpbpobfflnpcgagjijhmgnchggcjblin\1.0.0_0\content.js

`document.addEventListener("DOMContentLoaded", ready); // send spdy info for current page function ready(){ chrome.runtime.sendMessage({ spdy: wasFetchedViaSpdy(), info: npnNegotiatedProtocol() || connectionInfo() });

chrome.runtime.onMessage.addListener(function (res, sender, sendResponse) { chrome.runtime.sendMessage({ spdy: wasFetchedViaSpdy(), info: npnNegotiatedProtocol() || connectionInfo() }); }); } function wasFetchedViaSpdy() { // SPDY is deprecated in favor of HTTP/2, but this implementation returns // true for HTTP/2 or HTTP2+QUIC/39 as well. if (window.PerformanceNavigationTiming) { const ntEntry = performance.getEntriesByType('navigation')[0]; return ['h2', 'hq'].includes(ntEntry.nextHopProtocol); } } function npnNegotiatedProtocol() { // NPN is deprecated in favor of ALPN, but this implementation returns the // HTTP/2 or HTTP2+QUIC/39 requests negotiated via ALPN. if (window.PerformanceNavigationTiming) { const ntEntry = performance.getEntriesByType('navigation')[0]; return ['h2', 'hq'].includes(ntEntry.nextHopProtocol) ? ntEntry.nextHopProtocol : 'unknown'; } } function connectionInfo() { if (window.PerformanceNavigationTiming) { const ntEntry = performance.getEntriesByType('navigation')[0]; return ntEntry.nextHopProtocol; } }`