Showing the changes to libraries/script-engine/src/AssetScriptingInterface.cpp (1 of 3 files). Show all
Unified · Split
| @@ -215,6 +215,21 @@ void AssetScriptingInterface::deleteAsset(QScriptValue options, QScriptValue sco · 214 unmodified lines | ||
| 215 | 215 | jsVerify(false, "TODO: deleteAsset API"); |
| 216 | 216 | } |
| 217 | 217 | |
| 218 | +/**jsdoc | |
| 219 | + * @typedef {string} Assets.GetOptions.ResponseType | |
| 220 | + * <p>Available <code>responseType</code> values for use with @{link Assets.getAsset} and @{link Assets.loadFromCache} configuration option. </p> | |
| 221 | + * <table> | |
| 222 | + * <thead> | |
| 223 | + * <tr><th>responseType</th><th>typeof response value</th></tr> | |
| 224 | + * </thead> | |
| 225 | + * <tbody> | |
| 226 | + * <tr><td><code>"text"</code></td><td>contents returned as utf-8 decoded <code>String</code> value</td></tr> | |
| 227 | + * <tr><td><code>"arraybuffer"</code></td><td>contents as a binary <code>ArrayBuffer</code> object</td></tr> | |
| 228 | + * <tr><td><code>"json"</code></td><td>contents as a parsed <code>JSON</code> object</td></tr> | |
| 229 | + * </tbody> | |
| 230 | + * </table> | |
| 231 | + */ | |
| 232 | + | |
| 218 | 233 | void AssetScriptingInterface::getAsset(QScriptValue options, QScriptValue scope, QScriptValue callback) { |
| 219 | 234 | JS_VERIFY(options.isObject() || options.isString(), "expected request options Object or URL as first parameter"); |
| 220 | 235 | |
| @@ -224,7 +239,7 @@ void AssetScriptingInterface::getAsset(QScriptValue options, QScriptValue scope, · 3 unmodified lines | ||
| 224 | 239 | if (options.isString()) { |
| 225 | 240 | url = options.toString(); |
| 226 | 241 | } |
| 227 | − if (responseType.isEmpty() || responseType == "string") { | |
| 242 | + if (responseType.isEmpty()) { | |
| 228 | 243 | responseType = "text"; |
| 229 | 244 | } |
| 230 | 245 | auto asset = AssetUtils::getATPUrl(url).path(); |
| @@ -389,8 +404,7 @@ bool AssetScriptingInterface::canWriteCacheValue(const QUrl& url) { · 158 unmodified lines | ||
| 389 | 404 | // allow cache writes only from Client, EntityServer and Agent scripts |
| 390 | 405 | bool isAllowedContext = ( |
| 391 | 406 | scriptEngine->isClientScript() || |
| 392 | − scriptEngine->isAgentScript() || | |
| 393 | − scriptEngine->isEntityServerScript() | |
| 407 | + scriptEngine->isAgentScript() | |
| 394 | 408 | ); |
| 395 | 409 | if (!isAllowedContext) { |
| 396 | 410 | qCDebug(scriptengine) << __FUNCTION__ << "invalid context" << scriptEngine->getContext() << url; |