Chrome Debugger Not Working on Local Files - google-chrome

I am trying to debug some Javascript locally, but I'm running in to a strange issue. If I open a local file like:
<html>
<head>
<script src="file.js"></script>
</head>
<body></body>
</html>
with a file.js that is just:
(function() {
'use strict';
debugger
})();
it fails to pause on the debugging line. However, if I open that exact same file in Firefox/Firebug, it does pause on that line. Also, if I add debugger lines to files served on my local server (ie. http:// files instead of file:// files) the Chrome debugger pauses as expected.
The problem only manifests (as far as I can tell) in Chrome with local files. However, I've googled a lot and I haven't been able to find any sort of "disable debugger in local files" option for Chrome or anything like that (that I might have accidentally enabled).
Has anyone ever seen this before, and if so were you able to resolve it?

So it turned out that the problem was a flag I had added to Chrome. By default Chrome won't let your local files access other local files, so I had enabled local-file-loading with the command line flag:
--allow-file-access-from-files
That worked great, except it caused a side effect I didn't realize: when you run local files (or at least local files loaded by other local files) Chrome apparently "sandboxes" them. Unfortunately, Chrome also refuses to debug "sandboxed" code, which meant that my debugger was mysteriously failing.
So, for anyone who wants to run local files in Chrome (say to run a web-based testing framework), the trick is to first add the above flag, but then also add this flag:
--allow-sandbox-debugging
so that Chrome will still trigger the debugger when your code includes a debugger line in a local file.

Related

ERR_CERT_AUTHORITY_INVALID error in Chrome while using Overrides

I'm trying to test some features in a production environment, and to achieve this I'm using Google Chrome overrides, that basically allows you to substitute a remote file with a local file.
It sometimes works, but after a couple of reloads it stops working and all the requests start failing, receiving this error in console:
Pay attention: I'm not talking of the full page warning that you see when you access an untrusted website, which has the same error code. I'm talking about the error in console which makes the website unusable.
I say this because I tried googling the error and I only see articles about the warning, that you can easily skip. This is a different subject.
What I tried so far, without success is:
Start chrome with the --ignore-certificate-errors flag
Enabling the allow-insecure-localhost flag in chrome://flags
But they didn't help. How can I tell Chrome to ignore the (inexistent) certificate?
Thank you
Edit
I add an image of my override configuration:
to-override is my local folder. Then I just clicked on a file in the source tab and selected save for override. I found the file in my local folder and I changed it. Changes are applied the first time, but on refresh everything stops working and all the requests fail.
My Chrome version is
71.0.3578.98 - stable - 64 bit

Chrome is using a cached page when local-serving for web-development

I'm using a node.js local server to serve Chrome a three.js page, and Chrome instead of updating the page when I reload it after I've done some changes, it reloads a cached version instead, and will only update it after I clear all history, then close and re-open the dumb Chrome, which is extremely frustrating and inefficient. That doesn't happen with Firefox. Any ideas?
node.js server run on a .bat file inside the working folder:
http-server -p 8000
exit
on address bar:
http://localhost:8000/mypage.html

Possible to view yesterday's version of a hopefully cached JavaScript file in Chrome?

Using Chrome 61. iCloud Drive mysteriously seems to have reverted a JavaScript file I worked a long time on to a previous version (before I did a git commit). I had viewed this file repeatedly in Chrome (srced from an html page). Is it possible Chrome still has a copy of this somewhere?
Any other way I could possible recover this file? iCloud Drive doesn't appear to have revision history as I thought (I can only recover deleted files).
Pheww, I got it!
Shut down my web server
Loaded the page in Chrome
Chrome expectedly reported the server refused the connection
Clicked view page source
There it was!

Mac Chrome "Package Invalid Details: Could not load extension icon"

I'm running into an issue with my Chrome extension on OSX computers only. It used to work fine, but with my latest release, I have a lot of files that I organized into folders (css, js, and img). The extension installs just fine on Windows computers (which is the OS I created the extension on, Windows 7) but when I attempt to install on a Mac I get the message outlined below:
"Package is invalid. Details: 'Could not load extension icon 'img\icon_16.png'.'.
I know the image is there, but my guess is that because I did this on Windows, OSX doesn't like the pathing options. Any ideas how I can rectify this and still keep the folder organization?
Late, I'm aware, but the solution to this was the slash in img\, reversed it and it worked fine.
In my case the problem was that Google Play allows zip with .crx file.
So on first attempt it said me to zip my crx (after crx upload try), then it said that it needs manifest file inside the zip file.
After that everything was fine except of extension installation - it threw out error like "Could not load extension icon".
So the solution is to compress src directory (in which manifest file lays) without packing extension into crx.

FileReader API working in jsFiddle, but not from local file

I'm working on a Chrome/Firefox extension which will be using the file API to store files locally. I'm trying to get an example up and running but I'm running into issues which seem to center around Chrome. Can anyone explain why this jsFiddle works fine, but the exact same code, when run from a local file, doesn't work. Please note that it works fine in Firefox, just not in Chrome. Any ideas?
Chrome has unusually restrictive web security; many things, like Ajax, won't work when run locally. This is one of them. You can get around this problem by either using a local websever, like #ephemient suggests, or you can run Chrome in unsafe mode for testing:
chrome.exe --disable-web-security
Yep. Chrome's SOP prevents just about everything in file:// from working[1]. Use a local webserver instead.
If you are using chrome. Start the chrome from command line with the flag
--allow-file-access-from-files
chrome doesn't support for accessing local file without this flag.