Hi,
A day ago, I updated Google Chrome dev channel build to the latest version. In my install dir I see two version, 17.0.963.0 and 17.0.963.2. The initial version ran page speed extension fine. But after an update, it’s causing this weird error. When I open the debugger tools, I get “Woops it looks like the DevTools Extensions API is unavailable from the remote browser”. I have attached a screenshot of the error below. The update took place automatically and told me to restart the browser. I want page speed extension working. If I disable the extension, this error no longer shows. Does anyone know how to fix this?
My current version is 17.0.963.2 dev-m
//–end screenshot.
I have included the source here:
function fetchDevToolsAPI (callback) {
// Attempt to load the extension API from each source file in order,
// until one succeeds. On success, invoke the callback.
var loadExtensionAPI = function (srcArray) {
// ExtensionAPI.js expects WebInspector to be an object.
window.WebInspector = { };
//HERE is the problem. IF condition is not satisfied, I guess. So it goes into the ELSE condition
which is the alert message shown in the screenshot.
if (srcArray && srcArray.length > 0) {
var script = document.createElement("script");
script.async = false;
script.onload = script.onerror = function () {
// For Chrome 16 or newer, check if devtools is available.
if ("devtools" in chrome.experimental) {
delete window.WebInspector;
callback();
return;
}
// For Chrome 15 or ealier:
// Once Extension API has been injected into the page,
// WebInspector.injectedExtensionAPI() will be available.
// Inject init_devtools_api to call the API initialization
// function.
if (WebInspector.injectedExtensionAPI) {
// Fetch successfull... call init function and callback.
WebInspector.injectedExtensionAPI(null, null, "pagespeed");
delete window.WebInspector;
callback();
} else {
// Fetch failed... try next URL.
loadExtensionAPI(srcArray.slice(1));
}
};
script.src = srcArray[0];
document.head.appendChild(script);
} else {
alert("Whoops, it looks like the DevTools Extensions API is " +
"unavailable from the remote browser.
" +
"ExtensionsAPI.js must be be available under Chrome/" +
"Application/<version>/Resources/Inspector/devTools.css, " +
"which is currently only the case for local builds that " +
"have 'debug_devtools': 1 set in GYP config. If you " +
"want to play with it, copy the file from " +
"http://trac.webkit.org/browser/trunk/Source/WebCore/" +
"inspector/front-end/ExtensionAPI.js");
delete window.WebInspector;
}
}
// If the webInspector API is unavailable, then we need to fetch it.
if (!window.webInspector) {
// Try fetching from several different URLs:
loadExtensionAPI([
// A. DevTools.js includes ExtensionAPI plus a bunch of stuff we
// don't need.
document.referrer.replace(/devtools.html?.*$/, "DevTools.js"),
// B. document.referrer should be the URL of the remote
// devtools. For Chrome 16 or newer, devtools_extension_api.js should
// reside at the same location.
document.referrer.replace(/devtools.html?.*$/,
"devtools_extension_api.js"),
// C. document.referrer should be the URL of the remote
// devtools. ExtensionAPI.js should reside at the same
// location for Chrome 15 or earlier.
document.referrer.replace(/devtools.html?.*$/, "ExtensionAPI.js"),
// D. Fall back on fetching the most recent version from trac.
"http://trac.webkit.org/browser/trunk/Source/WebCore/inspector/" +
"front-end/ExtensionAPI.js?format=txt",
]);
} else {
callback();
}
}
Also where should I put the ExtensionsAPI.js, which it says to download from trac? Any ideas?
Thanks.