Hi, I am using QtWebkit in my product, and yesterday I got a strange problem. I tyied to Inject objects into javascript environment in this way:
There are two QObjects I want to injcect, named "A" and "B", and A is the parent of B. QObject *A = ... QObject *B = ... B->setParent(A); A->setObjectName("A"); B->setObjectName("B"); QWebFrame *frame = ... // the target frame connect(frame, SIGNAL(javaScriptWindowObjectCleared()),this, SLOT(Inject())); And in Inject slot: frame->addToJavaScriptWindowObject(A->objectName(), A); QString js("A.B.foo = 'bar';"); frame->evaluateJavaScript(js); Then the strange thing happens, I can access A.B.foo successfully at first time, but if I do some other operations, for example, invoke the web inspector or close another window in my app(which has no business with current window), then the A.B.foo is gone! But A.B is still there, and all INVOKABLE methods and properties are still accessible. I am not sure whether it is a bug, the Qt version is 4.7.3. -- Best Regards - Kang Liu
_______________________________________________ webkit-qt mailing list webkit-qt@lists.webkit.org http://lists.webkit.org/mailman/listinfo.cgi/webkit-qt