When a QtWebKit based application returns a null string, it is converted to an empty string. From the JavaScript side, it is not possible to tell if the return value was an empty string or null.
Created attachment 26630 [details] change qt-runtime so it does not convert a null string to an empty string.
Comment on attachment 26630 [details] change qt-runtime so it does not convert a null string to an empty string. > - QCOMPARE(evalJS("myObject.stringProperty"), QString()); > + QCOMPARE(evalJS("myObject.stringProperty"), sUndefined); As discussed on IRC this behavior should apply to QVariants instead. > + if (variant.isNull() ) { > + if (type == QMetaType::QString) > + return jsUndefined(); So that if !variant.isValid() then return jsUndefined(); A default-constructed QVarant is not valid, i.e has the type set to QMetaType::Invalid
Created attachment 26684 [details] Return jsundefined instead of jsnull. This patch is not a solution to the bug, it was created to allow others to continue experimenting with the problem. In fact it breaks the test case evalJSV("myObject.myInvokableWithVariantArg(null)", type);
Closing as duplicate of bug 31863. Integration between QtWebKit - QtScript is a nicer and more generic solution. If I'm wrong feel free to reopen the bug. *** This bug has been marked as a duplicate of bug 31863 ***
Moving all JavaScriptGlue bugs to JavaScriptCore. The JavaScriptGlue framework itself is long gone. And most of the more recent bugs put in this component were put there by people who thought this was for some other aspect of “JavaScript glue” and have nothing to do with the actual original reason for the existence of this component, which was an OS-X-only framework named JavaScriptGlue.