Unable to modify args in onBeforeCommandLineProcessing

Having problems with building or using the JCEF Java binding? Ask your questions here.

Unable to modify args in onBeforeCommandLineProcessing

Postby JohnnyTheHun » Tue Apr 10, 2018 2:00 pm

According to the javadoc: CefAppHandler.onBeforeCommandLineProcessing
Provides an opportunity to view and/or modify command-line arguments before processing by CEF and Chromium.

So I overrid this function and added it via:
Code: Select all
CefApp.addAppHandler(....)


First I tried to check what arguments it had, but I got an Exception at the following line:
Code: Select all
Vector<String> args = command_line.getArguments();


Code: Select all
java.lang.NoSuchMethodError: add
   at org.cef.callback.CefCommandLine_N.N_getArguments(Native Method)
   at org.cef.callback.CefCommandLine_N.getArguments(CefCommandLine_N.java:110)
   at javaceftest.SimpleMainFrame$1.onBeforeCommandLineProcessing(SimpleMainFrame.java:84) //the line of code shown above
   at org.cef.CefApp.N_Initialize(Native Method)
   at org.cef.CefApp.access$600(CefApp.java:27)
   at org.cef.CefApp$4.run(CefApp.java:430)
   at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:301)
   at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756)
   at java.awt.EventQueue.access$500(EventQueue.java:97)
   at java.awt.EventQueue$3.run(EventQueue.java:709)
   at java.awt.EventQueue$3.run(EventQueue.java:703)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
   at java.awt.EventQueue.dispatchEvent(EventQueue.java:726)
   at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
   at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
   at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
   at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)


My goal: to override the --disable-extensions switch to be able to use the built-in pdf viewer. Can I accomplish it through onBeforeCommandLineProcessing or do we have to recompile jcef?

I was unable to find the --disable-extensions switch in the CefCommandLine and the only modifications that seemed available was the reset() function.

Thank you,
János
JohnnyTheHun
Techie
 
Posts: 42
Joined: Tue Apr 10, 2018 12:24 pm

Re: Unable to modify args in onBeforeCommandLineProcessing

Postby magreenblatt » Tue Apr 10, 2018 3:20 pm

Please add a bug report for the Exception at https://bitbucket.org/chromiumembedded/ ... issues/new.

You can remove the --disable-extensions switch in https://bitbucket.org/chromiumembedded/ ... app.cpp-77 and recompile JCEF.
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm


Return to JCEF Forum

Who is online

Users browsing this forum: No registered users and 15 guests