There are two QObjects to be injcected to JS context, named "A" and "B", and A is the parent of B. frame->addToJavaScriptWindowObject(A->objectName(), A); QString js("A.B.foo = 'bar';"); frame->evaluateJavaScript(js); The property A.B.foo is not persistent: it is no longer accessible after doing some operations, for example, invoke the web inspector.
The Qt port has been removed from WebKit, resolving.