Chrome Commands API not working - google-chrome

I have been trying to get the chrome commands api to work, with no success.
I know about both common problems that people are having:
If you change the command keys in the manifest file you need to remove and reinstall it for the changes to take effect.
Even if you do this, you may also need to scroll down on the extensions page, click the keyboard shortcuts link, and set the commands manually.
I have tried both solutions, even though I'm not sure that the second is still necessary. When I first load the extension, the commands are already loaded and set to the keys I specified in my manifest file.
I have even downloaded the sample commands extension, and tried the commands there.
https://developer.chrome.com/extensions/examples/api/commands.zip
The only even that triggers correctly is the browser action. The other command in the example does not work. It does not trigger a console log as far as I can see.
Anybody know whats up?
Edit:
It seems logical to me that the console log would happen in the tab that I had active, but apparently not.
Xan's comment got me thinking, so I added an alert to the command listener in the background.js file of the sample extension.
Sure enough, the alert was triggered. No console log though. No idea where my log is getting sent, but the API is working... just without console output.
Check out Xan's comments for where the log is actually being sent

Related

Chrome ERR_EMPTY_RESPONSE

I have a problem with chrome which don't display some of my static files (css, js mainly). it says that an empty response has been sent by the server
but when I try to "curl" the same URL, it works
I don't really know what's wrong here. I tried disabling cache, clearing all type of cache, incognito mode, disabling chrome extensions... none of those worked
thanks
update
If I try to access the same URL with a random parameter in query string (let's say ?id=1), it works but only once ! when I refresh the page, I get the same error, and so on...
I finally found the problem :
I had something wrong in my .htaccess file. I had module_deflate which wasn't enabled in my apache configuration, so somehow, this prevented my local website to work properly. Just enabled it in my /etc/apache/http.conf and that's it.
If you get the same problem, I would recommend to comment all your .htaccess lines and then uncomment them one by one to see if any of them can cause the problem.
hope this would help someone else.

PhpStorm debug HTTP request not hitting breakpoint

I am fairly certain that I have PhpStorm configured correctly for debugging. When I create a run configuration as "PHP Script", the debugger functions as expected.
Now, I want to debug an "HTTP request" as described in the official documentation, because I want to pass some $_GET parameters - note, this is an AJAX request from the browser.
However, despite following it, the debugger hits no breakpoints; not even on the first code line - even when I set the "stop on first line" option.
When I click the URL indicated by the red arrow, it is launched in the browser (without the parameters), so the path looks ok. I see no PHP errors or warnings in the IDE, nor when I launch teh page int he browser.
vlocalhost` is running just fine.
Any idea what I am doing wrongly?
[Update] With thanks to #LazyOne for that comment.
File/Settings ... Languages & Frameworks/PHP/Debug, point 1), click the "validate" link.
The path shown was the path to the script, which is not the root of localhost. Changing it to the root of localhost validated and is valid - but I still don't hit any breakpoints :-(
This might help some using Windows.
Go to File > Settings > PHP > Servers and uncheck 'use path mappings...'
With thanks to #LazyOne for that comment.
File/Settings ... Languages & Frameworks/PHP/Debug, point 2), seems to have fixed it, installing the browser plugin from https://www.jetbrains.com/help/phpstorm/browser-debugging-extensions.html and activating it (point 3 might also have helped; try it if point 2 isn't enough for you)

Writing Chrome/V8 --trace-gc output to a file - stdout redirection does not work

We are working on an automated system for memory performance monitoring.
We start Chrome with proper flags --trace-gc --trace-gc-verbose both on Windows7 and MacOSX High Sierra.
The output is printed and visible on the console. However capturing the output with standard stream redirection does not work:
What do we do:
MacOS X:
./Google\ Chrome --js-flags="--trace-gc --trace-gc-verbose" > log.txt 2>&1
Windows:
chrome --no-sandbox --js-flags="--trace_gc --trace_gc_verbose" > log.txt 2>&1
What gets written into the log file is only a part of what you can see on the screen: all gc-related data is missing in the file although abundant in the terminal window (you can see all the data when you run the app without stream capture at all).
We suppose a new process for V8 is run and it's output is not directed to stdout, though somewhat it gets printed to the console itself.
The V8 C++ code shows no mark of such a strange redirect, pretty clean standard code, in fact one can record gc-output of node --trace-gc script.js without any problem with standard stdout/stderr. It seems Chrome adds the undesired behavior.
Question how to record Chrome gc-related data to a file both on Windows and MacOS X.
Partial, unacceptable solution on POSIX-based systems we can grab all the terminal output with script command. The dump contains all the data we need, but the solution does not cover Windows scenario (we do need tests on Windows) and in fact it does not solve the problem neither explains the reason behind the lacking data, it simply hides the problem away.
I think there are two things worth being pointed out.
The only output that is actually being redirected is Chrome-related. I mean if we redirect stderr to a file we can see the errors in this file, but only Chrome's errors not V8's.
I wanted to use script command as I tried Powershell Start-Transcript, Tee and a few other options. It has turned out (no suprises here) that Windows has no command that can be used to achieve desired effect (AFAIK). So I used Babun (http://babun.github.io/) which is basically preconfigured Cygwin. No GC log has been displayed. Only Chrome's related stuff. I think that V8's logs are not being forwarded to Cygwin.
UPDATE:
This issue may be somehow related with these:
Chrome spawns many processes and from what I can see from logs - GC logs are gathered from child process (different PID than one related with opened terminal window). I do not know how this alone could affect STDOUT redirection. It's just a fact I noticed.
I found out that an application may know if its STOUD is being redirected and handle this situation differently - e. i. using buffers without flushing when STDOUT is being redirected to a file but not if it is printed on the console.
UPDATE:
I have created a following bug: https://bugs.chromium.org/p/chromium/issues/detail?id=865876#c3
It seems like it was noticed and someone is going to take care of it.
UPDATE:
It seems like ChromeDriver can do exactly what we need - http://chromedriver.chromium.org/logging/performance-log
Another workaround would be to run Chrome with --enable-precise-memory-info and the periodically invoke window.performance.memory, but that command does not provide us with nearly as much data as ChromeDriver

Unwanted Output In Console

I've started to get some strange output in my developer console. I was wondering if there was a way to turn it off.
Net state changed from IDLE to BUSY
That outputs whenever anything server side is called, you can imagine that it might cause a lot of clutter.
I was faced out with this issue also, tried to google, but no results.
Do not worry. This output appears when you call add-on back-end by calling google.script.run. It is default output for debugging the state of a connection.
Probably you have a loop that gets information from the add-on backend infinitely.
I'm assuming the messages are coming from warden source.
To solve this, you can simply right click (Windows) or double click (Mac) to bring up the help menu. Then access Filter and click the source of the element you want to filter out of your console. It should then disappear.
Let me know how that works

Is there any way to defer HTML5 manifest checking?

Given that there is a way to invoke an update directly using window.applicationCache.update(), is there any way to omit the update that is performed automatically by the browser when the page is loaded?
I've been experimenting with offline mode in Google Chrome, and so far it appears that
1) If a manifest file is specified, it will be loaded, and there is nothing I can do in JavaScript to stop it.
2) If the manifest file has changed, the entire cache is going to be updated, and there is nothing I can do to stop it.
In my experience, window.applicationCache.abort() has no effect regardless of when I invoke it. I've tried invoking it on the first line of javascript, and in the checking and downloading events, but it always downloads everything. It may have something to do with timing since the files are small and load very quickly.
Listen for the checking event and cancel it. The abort() method doesn't come into things until step 17 of the application cache download process, I don't think you're going to be able to stop the process with it.
This is a Chrome bug at the time of writing: https://code.google.com/p/chromium/issues/detail?id=175063 (please vote it up)
Just tried this on iOS Safari:
window.applicationCache.addEventListener('checking', function(event) {
window.applicationCache.abort();
}, false);
It works. In Safari debugger console:
Application Cache download process was aborted.
Chrome ignores the same code.