Skip to content

Commit 499fefa

Browse files
committed
Fix remote debugging not working
1 parent 56ff5e3 commit 499fefa

File tree

3 files changed

+30
-6
lines changed

3 files changed

+30
-6
lines changed

java/org.eclipse.set.browser.lib/src/org/eclipse/set/browser/lib/cef_command_line_t.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@ public class cef_command_line_t {
1818
*
1919
* @param command_line
2020
* the command line
21+
* @param cmdSwitch
22+
* the switch to append
23+
* @param value
24+
* switch value (or null if no value)
2125
*/
22-
public static native void cefswt_disable_component_update(
23-
final long command_line);
26+
public static native void cefswt_append_switch(
27+
final long command_line, final String cmdSwitch, String value);
2428
}

java/org.eclipse.set.browser/src/org/eclipse/set/browser/cef/handlers/AppHandler.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
*/
99
package org.eclipse.set.browser.cef.handlers;
1010

11+
import org.eclipse.set.browser.cef.ChromiumStatic;
1112
import org.eclipse.set.browser.lib.ChromiumLib;
1213
import org.eclipse.set.browser.lib.cef_command_line_t;
1314

@@ -42,6 +43,13 @@ private long get_browser_process_handler(final long app) {
4243

4344
@SuppressWarnings({ "unused", "static-method" }) // Called via JNI
4445
private void on_before_command_line_processing(final long app, final long process_type, final long command_line) {
45-
cef_command_line_t.cefswt_disable_component_update(command_line);
46+
// Disable updating Chromium components from Google servers
47+
cef_command_line_t.cefswt_append_switch(command_line, "disable-component-update", null);
48+
49+
// If debugging is enabled, allow remote debugging
50+
if(ChromiumStatic.getCEFConfiguration().DebugPort != 0)
51+
{
52+
cef_command_line_t.cefswt_append_switch(command_line, "remote-allow-origins", "*");
53+
}
4654
}
4755
}

native/chromium_swt/src/lib.rs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,19 @@ pub fn cefswt_request_to_java(request: *mut chromium::cef::_cef_request_t) -> *m
333333
}
334334

335335
#[jni_wrapper("org.eclipse.set.browser.lib.cef_command_line_t")]
336-
pub fn cefswt_disable_component_update(command_line: *mut chromium::cef::_cef_command_line_t) {
337-
let switch = chromium::utils::cef_string("disable-component-update");
338-
unsafe { ((*command_line).append_switch.unwrap())(command_line, &switch) }
336+
pub fn cefswt_append_switch(
337+
command_line: *mut chromium::cef::_cef_command_line_t,
338+
switch: *const c_char,
339+
value: *const c_char,
340+
) {
341+
let switch = chromium::utils::cef_string_from_c(switch);
342+
343+
if !value.is_null() {
344+
let value = chromium::utils::cef_string_from_c(value);
345+
unsafe {
346+
((*command_line).append_switch_with_value.unwrap())(command_line, &switch, &value)
347+
}
348+
} else {
349+
unsafe { ((*command_line).append_switch.unwrap())(command_line, &switch) }
350+
}
339351
}

0 commit comments

Comments
 (0)