diff --git a/src/greeter.c b/src/greeter.c index 8d02115..98077de 100644 --- a/src/greeter.c +++ b/src/greeter.c @@ -202,7 +202,8 @@ load_script(char *script) { static void -page_loaded_handler(void) { +greeter_loaded_handler(void) { + load_script("/com/antergos/lightdm-webkit2-greeter/js/GreeterConfig.js"); load_script("/com/antergos/lightdm-webkit2-greeter/js/ThemeUtils.js"); load_script("/com/antergos/lightdm-webkit2-greeter/js/ThemeHeartbeat.js"); } @@ -243,8 +244,8 @@ message_received_cb(WebKitUserContentManager *manager, printf("Error running javascript: unexpected return value"); } - if (strcmp(message_str, "PageLoaded") == 0) { - page_loaded_handler(); + if (strcmp(message_str, "GreeterLoaded") == 0) { + greeter_loaded_handler(); } else if (strcmp(message_str, "LockHint") == 0) { lock_hint_enabled_handler(); diff --git a/src/gresource/js/ThemeUtils.js b/src/gresource/js/ThemeUtils.js index f579a98..438c202 100644 --- a/src/gresource/js/ThemeUtils.js +++ b/src/gresource/js/ThemeUtils.js @@ -65,8 +65,6 @@ class ThemeUtils { } } } - - static } window.theme_utils = __ThemeUtils; diff --git a/src/webkit2-extension.c b/src/webkit2-extension.c index d6e182d..da579f3 100644 --- a/src/webkit2-extension.c +++ b/src/webkit2-extension.c @@ -1587,7 +1587,7 @@ window_object_cleared_callback(WebKitScriptWorld *world, globalObject; gchar *lock_hint_message = "LockHint"; - gchar *page_loaded_message = "PageLoaded"; + gchar *greeter_loaded_message = "GreeterLoaded"; jsContext = webkit_frame_get_javascript_context_for_script_world(frame, world); globalObject = JSContextGetGlobalObject(jsContext); @@ -1622,7 +1622,7 @@ window_object_cleared_callback(WebKitScriptWorld *world, globalObject, JSStringCreateWithUTF8CString("__GreeterConfig"), greeter_config_object, - kJSPropertyAttributeDontEnum, + kJSPropertyAttributeDontEnum | kJSPropertyAttributeReadOnly, NULL); theme_utils_object = JSObjectMake(jsContext, theme_utils_class, NULL); @@ -1630,7 +1630,7 @@ window_object_cleared_callback(WebKitScriptWorld *world, globalObject, JSStringCreateWithUTF8CString("__ThemeUtils"), theme_utils_object, - kJSPropertyAttributeDontEnum, + kJSPropertyAttributeDontEnum | kJSPropertyAttributeReadOnly, NULL); dom_document = webkit_web_page_get_dom_document(web_page); @@ -1639,7 +1639,7 @@ window_object_cleared_callback(WebKitScriptWorld *world, if (dom_window) { /* Notify the UI process that the greeter is loaded */ webkit_dom_dom_window_webkit_message_handlers_post_message( - dom_window, "GreeterBridge", page_loaded_message + dom_window, "GreeterBridge", greeter_loaded_message ); /* If the greeter was started as a lock-screen, notify our UI process. */