NPAPI plugin does not show in about:plugins in google chrome - npapi

I have gone through the questions in this forum regarding this issues, but I have not found any query related to the kind of issue that I am facing. I have written a NPAPI plugin which works fine with GtkLauncher (comes with webkit) and firefox, but with google-chrome (18.0.1025.151), the plugin is not even showing up in about:plugins. I am running on Ubuntu 10.10.
When I am loading the plugin in google-chrome, in the browser I am getting failed to load plugin error but nothing is shown on the console. I doubt whether my NP_Initialize function is getting called.
Here is the NP_Initialize code:
-------------------------------
NPError OSCALL
NP_Initialize(NPNetscapeFuncs *npnf
#if !defined(_WINDOWS) && !defined(WEBKIT_DARWIN_SDK)
, NPPluginFuncs *nppfuncs)
#else
)
#endif
{
MEDIA_DEBUG_PRINT("\nwcf Media plugin: NP_Initialize");
if(npnf == NULL)
return NPERR_INVALID_FUNCTABLE_ERROR;
if(HIBYTE(npnf->version) > NP_VERSION_MAJOR)
return NPERR_INCOMPATIBLE_VERSION_ERROR;
npnfuncs = npnf;
#if !defined(_WINDOWS) && !defined(WEBKIT_DARWIN_SDK)
NP_GetEntryPoints(nppfuncs);
#endif
return NPERR_NO_ERROR;
}
NPError OSCALL
NP_GetEntryPoints(NPPluginFuncs *nppfuncs)
{
MEDIA_DEBUG_PRINT("\nwcf Media plugin: NP_GetEntryPoints");
nppfuncs->version = (NP_VERSION_MAJOR << 8) | NP_VERSION_MINOR;
nppfuncs->newp = nevv;
nppfuncs->destroy = destroy;
nppfuncs->getvalue = getValue;
nppfuncs->event = handleEvent;
nppfuncs->setwindow = setWindow;
return NPERR_NO_ERROR;
}
I know there is a Firebreath framework for cross browser development which I have plan to use but at present I need to get my plugin running on chrome.
Can some one please help me to solve my issue?
Thanks and Regards,
Souvik

Chrome tends to be a bit pickier about how things start up. I don't see anything here that would be likely to cause your issue, but Chrome is notorious for rejecting plugins that don't behave as it expects. Most likely your issue is later on; you say you doubt that your NP_Initialize is getting called, if I were you I'd verify that. Have it write to a file in /tmp/ or something to make sure.
Also you haven't provided any of your other entrypoints such as NP_GetPluginVersion or NP_GetMimeDescription. Those are needed as well for a linux plugin and could very possibly be responsible for an issue like this. For reference, take a look at FireBreath's X11 entrypoint file.
Finally, it's possible that the way you installed the plugin it is found by mozilla and not by chrome; how did you install it?

If your plugin isn't showing in chrome://plugins, then it's failing during the initial plugin scan. Try running with the --debug-plugin-loading flag, which should give you a log statement at the point where registering your plugin is failing.

Related

How to get job and telescope command on chrome's V8 x64.release version? (No symbol "_v8_internal_Print_Object" in current context)

I'm trying to get chrome's V8 (d8) x64.release version to use the V8 support tools in GDB, specifically for the job and telescope commands (predominantly the former).
My x64.debug version has this implemented and works, but even after building the x64.release version in a similar manner I still cannot get these commands to work in the x64.release version. The output is always as:
gef➤ job 0xd98082f7b51
No symbol "_v8_internal_Print_Object" in current context.
I have set args.gn before, and after building via ninja -C to include v8_enable_object_print = true in my args.gn:
is_debug = false
target_cpu = "x64"
use_goma = false
v8_enable_object_print = true
v8_enable_disassembler = true
I also have my ~/.gdbinit containing:
source ~/Desktop/tools/v8/tools/gdbinit
source ~/Desktop/tools/v8/tools/gdb-v8-support.py
See: https://chromium.googlesource.com/v8/v8/+/refs/heads/main/tools/gdbinit (for the support tool I'm trying to build V8 with).
How can I get my /v8/out.gn/x64.release/d8 to run with compatibility of the job command?
Am I missing something here? If so your help would be very helpful.
EDIT Alternatively how can I disable all x64.debug V8 DCHECKS?
Thanks all, appreciate your time here.
How can I get my /v8/out.gn/x64.release/d8 to run with compatibility of the job command?
I'm not sure. Try adding symbol_level = 1 (or even symbol_level = 2) to your args.gn. That definitely helps with stack traces, and might also be the thing that lets GDB find the _v8_internal_Print_Object function by name.
Alternatively how can I disable all x64.debug V8 DCHECKS?
There is no flag to disable them, but you can edit the source to make them do nothing. See src/base/logging.h.

Permission issue for appium chrome borwser

I am implementing an appium test on remote android driver, with chrome browser for loading urls.
Some of the Urls are pdfs, and chrome asks to store those files. and appears that chrome doesnt have access to filesystem to store those files, which results in a dialog like below.
Please help me pass that dialog without any manual inputs.
Upon clicking continue, it will load actual permissions dialog from Android.
Here is my code initialize appium capabilities
DesiredCapabilities caps = DesiredCapabilities.android();
caps.setCapability("appiumVersion", "1.9.1");
caps.setCapability("deviceName","Samsung Galaxy S9 Plus HD GoogleAPI Emulator");
caps.setCapability("deviceOrientation", "portrait");
caps.setCapability("browserName", "Chrome");
caps.setCapability("platformVersion", "8.1");
caps.setCapability("platformName","Android");
caps.setCapability("autoAcceptAlerts", true);
caps.setCapability("autoGrantPermissions", true);
caps.setCapability("chromedriverArgs", "--allow-file-access-from-files");
caps.setCapability("maxDuration", 10000);
and this is the snippet I use to load a Url
driver.navigate().to("http://kmmc.in/wp-content/uploads/2014/01/lesson2.pdf");
autoGrantPermission also doesnt work in this case because chrome is already installed. Appium team has already rejected this issue -
https://github.com/appium/appium/issues/10008
Please help!
Indeed I had very hard time finding out the solution, but eventually I found a workaround.
The best workaround would have been reinstalling the chrome package. I tried that, but I could not start chrome after reinstalling it, as I had no access to shell, and chromedriver complained. So I left that track.
I tried getting hold of adb command or mobile:changePermissions but for that you need to use server flag --relaxed-security while starting the server, and saucelabs doesnt provide any handy interface to start the server with this flag.
The last resort, I found a solution here - https://stackoverflow.com/a/51241899/4675277 . But just that was not sufficient, because it helped me fix chrome alert, but later on it popped up with another alert with allow and deny, for which another solution in the same question helped me. So this is the code I eventually used -
driver.navigate().to("http://kmmc.in/wp-content/uploads/2014/01/lesson2.pdf");
String webContext = ((AndroidDriver)driver).getContext();
Set<String> contexts = ((AndroidDriver)driver).getContextHandles();
for (String context: contexts){
if (context.contains("NATIVE_APP")){
((AndroidDriver)driver).context(context);
break;
}
}
driver.findElement(By.id("android:id/button1")).click();
contexts = ((AndroidDriver)driver).getContextHandles();
for (String context: contexts){
if (context.contains("NATIVE_APP")){
((AndroidDriver)driver).context(context);
break;
}
}
driver.findElement(By.id("com.android.packageinstaller:id/permission_allow_button")).click();
((AndroidDriver)driver).context(webContext);
This helps allow all permissions required.

Quintus to Android

I have tried to Google and read the Quintus wiki but no solution. Why does quintus platformer need server to run? Because this I can't use phonegap nor cocoonjs to convert my project to android game. Is there a better HTML5 2d game engine that I can use without server? Or what can I do to get quintus run as android application?
So I finally managed to get the game running with little bit of help, so I am answering here for myself. To get the game running on Android phone you need to quote some code.
Try commenting out this code from your quintus.js file and try again. I was facing a similar issue, commenting out this code resolved it:
if(document.location.origin === "file://" || document.location.origin === "null") {
if(!Q.fileURLAlert) {
Q.fileURLAlert = true;
alert("Quintus Error: Loading assets is not supported from file:// urls - please run from a local web-server and try again");
}
return errorCallback();
Then compile it with CocoonJS Webview+ and install debug.apk to get the game running.

Creating an instance of a FireBreath plugin using ActiveXObject

I am using FireBreath to create a cross browser plugin. In the HTML test page i am using the following function to detect whether the plugin is installed and to initiate a download of the MSI installer if the plugin is not detected.
function checkPlugin(){
var pluginInstalled = false;
if ((navigator.userAgent.indexOf('MSIE') != -1) && (navigator.userAgent.indexOf('Win') != -1)) {
// For IE
var pluginObject = null;
try {
pluginObject = new ActiveXObject('Test.TestPlugin');
if(pluginObject){
pluginInstalled = true;
//pluginObject.Dispose();
}
} catch (e) {
// Cannot load the plugin. Most probably it's not installed
console.log(e.message);
}
}else{
// For other browsers
pluginInstalled = (navigator.mimeTypes && navigator.mimeTypes["application/x-test"] && navigator.plugins["TestPlugin"]);
}
return pluginInstalled;
}
Above function works fine on all other browsers except for IE. It causes both IE 9 and 10 to crash when it attempts to create an instance of the plugin using ActiveXObject. I have noted that support for this functionality was added from FireBreath 1.4 onwards but I believe i am using the latest version of FireBreath which is 1.7. Any assistance in solving this issue is greatly appreciated :)
That looks like the method used in the FireBreath javascript detection example, and that's what I'm using in my plugins. You weren't entirely clear on what version you're using; are you on 1.7? It works for me on 1.6 and 1.7 for sure.
If you could be a little more specific about where it crashes that might be easier to make some speculations; try attaching a debugger. For information on how to force IE to be single process to make attaching a debugger see the "Debugging Plugins" page on firebreath.org.

Strange issue when running tests on Chrome?

I am trying to run some simple tests on Chrome, and I have followed all required steps to do this. The tests start fine, the Chrome browser opens and is initialized correctly (it seems), but when my tests start to search for objects and check values on the web page.
(e.g.
[#browser.div(:id, "example").text.should == "test"]
or
[puts #browser.div(:id, "example").text]
) I get the next error and my tests fail: "Selenium::WebDriver::Error::UnkownError:".
This is it, only this message appears, with no clues or details on the error.
I simply do not know were to look for answers. I even tried to debug the tests but with no results.
I even search on known issues on chromedriver, but found nothing.
Another thing to mention is that the tests suite create by me is for cross browser testing.
These tests work fine on Firefox.
Am I doing something wrong in initializing the Chrome browser?
Here is the code from my env file:
require "rubygems"
require "rspec"
require "watir-webdriver"
require "watir-webdriver/extensions/alerts"
if ENV["HEADLESS"] then
include Selenium
capabilities = WebDriver::Remote::Capabilities.htmlunit(:javascript_enabled => true)
browser = Watir::Browser.new(:remote, :url => "http://127.0.0.1:4444/wd/hub", :desired_capabilities => capabilities)
elsif ENV["FIREFOX"] then
browser = Watir::Browser.new :firefox
elsif ENV["CHROME"] then
browser = Watir::Browser.new :chrome
elsif ENV["IE"] then
browser = Watir::Browser.new :ie
else
browser = Watir::Browser.new :chrome
end
Before do
#browser = browser
end
at_exit do
browser.close
end
I have tried also with the latest release in selenium-webdriver gem, and after this with an older version 2.21.0. Results are the same.
Can you give me a clue what am I doing wrong?
Thank you.
Well, obviously I did not checked with the latest version of chromedriver :).
The version from which the issue stops reproducing is the one from 23 of May 2012.
Thank you for the hint Željko!