RESOLVED DUPLICATE of bug 31863 23250
[Qt] NULL string should not be arbitrarily converted to empty string
https://bugs.webkit.org/show_bug.cgi?id=23250
Summary [Qt] NULL string should not be arbitrarily converted to empty string
Yael
Reported 2009-01-12 07:14:48 PST
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.
Attachments
change qt-runtime so it does not convert a null string to an empty string. (2.95 KB, patch)
2009-01-12 07:16 PST, Yael
vestbo: review-
Return jsundefined instead of jsnull. (1.24 KB, patch)
2009-01-13 14:50 PST, Yael
no flags
Yael
Comment 1 2009-01-12 07:16:51 PST
Created attachment 26630 [details] change qt-runtime so it does not convert a null string to an empty string.
Tor Arne Vestbø
Comment 2 2009-01-13 08:20:47 PST
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
Yael
Comment 3 2009-01-13 14:50:22 PST
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);
Jędrzej Nowacki
Comment 4 2009-11-26 01:50:17 PST
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 ***
Darin Adler
Comment 5 2014-04-24 16:44:55 PDT
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.
Note You need to log in before you can comment on or make changes to this bug.