Google Maps API non-minified/obfuscated - google-maps

Does Google provide non-minified / non-obfuscated versions of their various javascript API's?
For example, I'm using their LocalSearch control and getting a cryptic error "a is null". Setting a breakpoint in Firebug is not very helpful because I'm 3 levels deep in minified code.

There isn't a non-obfuscated version of the API (it isn't an open source project). If you post a link to the page in question, we might be able to help debug the issue?
I have seen the "a is null" message many times and each time have been able to track down the issue eventually.

As mentioned, there isn't a way to get the original version with real (helpful) variable and comments since it's not open source
But! There's a new(ish?) feature in Google Chrome Dev Tools where you can de-minify code ("make minified code human readable")
https://developers.google.com/web/tools/chrome-devtools/javascript/reference#format
should at least help a bit with debugging

Related

Origin trial controlled feature not enabled: 'interest-cohort' in static HTML page

I'm unable to understand the meaning of this error which I found in my console in the Edge browser:
Error with Permissions-Policy header: Origin trial controlled feature not enabled: 'interest-cohort'.
Your guidance is much appreciated.
I can't see any errors in my HTML file, and I don't use Google analytics.
This has to do with FLOC. Or Federated Learning of Cohorts. It's an old experiment that Google ran to try to do away with 3rd party cookies. Some code in your website is blocking Floc from running. Unblocking is fairly straight forward to get rid of the warning. But you have to make the decision if you want to unblock floc or leave as is. You will only see this issue in Chrome base browsers. We need to know what type of website you are running? Drupal? Wordpress? Versions?

I am not getting errors in GoogleAdsException But recieves in ApiException

I am trying to handle keyword policy violation error in google ads api. I am trying the given example. https://github.com/googleads/google-ads-php/blob/main/examples/ErrorHandling/HandleKeywordPolicyViolations.php
They say the error will be thrown in GoogleAdsException and it can be handled with the googleAdsException object. But I always get the error in ApiException.
Can anyone help me? Thank you in advance.
it's been a while, but I just stumbled across this. I had implemented it exactly as Google suggested. It worked just fine.
Now it no longer works. The only difference is that now I don't have grpc and protobuf compiled as an extension for PHP, but have pulled the packages in via composer as PHP source. And look, there is only the GoogleApiException. However, this contains all the necessary data, only I have to write a different handling.
Conclusion: I suspect it's because the PHP packages via composer give different results than the compiled PHP extensions.
I can't tell more precisely at the moment, because I can't test compiled extensions here right now.

How to disable Google Chrome source compression "?body=1"?

I'm trying to debug some JavaScript for a Rails project and its incredibly frustrating to go line by line when the source code is compressed in the Sources developer tab.
I know this compression is done by Chrome through the body variable. What I want to know is if there is any way to stop Chrome from compressing files in source view, i.e:
\application.js?body=1 --> \application.js
Thank you for your time.
Compression is being done by Rails. Disable it in your configuration:
# config/production.rb (or whatever environment you're in)
config.assets.compress = false
You might want to investigate a new feature in Chrome called Source Maps.
Source Maps allows Chrome to map the compressed source code it receives to the uncompressed original, which in turn means that you can debug the code, even though it's been compressed.
This feature should help you get around this kind of problem without having to change the compression settings on your server.
You can read more about it here: http://blog.mascaraengine.com/news/2012/4/16/sourcemap-support-in-chrome-greatly-improves-debugging.html
I believe this feature is still in test and not yet in the final release version of Chrome. I'm sure it will arrive in due course, but for the time being you may need to install the "Canary" version of Chrome, ie the pre-release version that includes all the forthcoming features that they're still working on.

Chrome Extension Internals

I am trying to understand the internals of Chrome Extension. It will be great if you can provide more details regarding this.
My understandings are as follows:
Extensions run in its own process.
Extensions interact with Browser process through IPC.
My question:
1. Whenever we call a extension api such as chrome.module.function() from extension user script, I would expect the function to go to the renderer process first and then send a IPC such as ExtensionHostMsg_ABC to the browser process to do the required operation.
Extension Process Browser Process
ExtensionHostMsg_Req
chrome.module.function() ----------------> Handle the msg
ExtensionMsg_Response
Send the result back to js <-----------------
But to my surprise, I see that all the extension api functions are declared and defined in chrome/browser/extensions/xyz_api.h & .cc files. So it looks like when a api is called from js, we come directly to the browser process. Where and how does this magic happens?
I also see some extensions bindings c++ code in chrome/renderer/extensions/abc_bindings.cc and the corresponding js code in chrome/renderer/extensions/resources/abc.js. I think we have this code to share some information between the extension renderer and js code. Is it right? Can you provide me a example scenario for this?
Sorry for asking these basic questions. I really appreciate your help.
Regarding your question on how the bindings are made. You define your extension API in chrome/common/extensions/api/extension_api.json which is how V8 sets up the C++ JavaScript bindings. That is where all the magic happens :)
If you want to call privileged APIs from the content script you would need to add the namespace to chrome/renderer/resources/extensions/renderer_extension_bindings.js
For more information regarding the design of the Extension System in Chromium, there are good docs that explain the whole process model and interactions:
http://www.chromium.org/developers/design-documents/extensions

How would I go about creating a custom protocol that would always open an address with a specific browser?

Okay, so I'm a student programmer in my college's IT department, and I'm doing browser compatibility for a web form my boss wrote. I need the user to be able to open a local file from a shared drive with a single click.
The problem is that Firefox and Chrome don't allow that for security reasons. Thus, I'm trying to write a custom protocol of my own to open an address in Internet Explorer regardless of the browser being used.
Can anyone help me with this? I'd also be willing to try an alternative solution to the problem.
The below worked for me, is this what you mean?
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\foo]
#="URL: foo Protocol"
"URL Protocol"=""
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\foo\DefaultIcon]
#="C:\\Program Files (x86)\\Internet Explorer\\iexplore.exe"
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\foo\shell]
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\foo\shell\open]
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\foo\shell\open\command]
#="C:\\Program Files (x86)\\Internet Explorer\\iexplore.exe \"%1\""
Just to note, I'm running Win7Pro, so you may have to move around file path(s) to conform to your environment.
And if that doesn't work, create a proxy between the protocol and the browser, pass the argument(s) from foo:// to that, parse what's necessary, then hand it off to IE using start iexplorer.exe "args".
I'm unsure whether I understand your question, if it is how do I open local files using chrome/firefox, this is your anwser:
First a disclaimer, I have never done this and cannot vouch for the accuracy of my response
IE
Microsoft's security model is pretty fail so you can go right ahead and open these files
FireFox
Some quick googling found that Firefox can do this after either editing prefs.js as outlined here or installing an addon called LocalLink
Chrome
Practically impossible due to its security, until now when locallink was ported to chrome.