1 /* 2 * Copyright (C) 2022 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.adservices.service.js; 18 19 /** Common constants for script engines. */ 20 public final class JSScriptEngineCommonConstants { 21 /** Named field for the result returned from the script. */ 22 public static final String RESULTS_FIELD_NAME = "results"; 23 24 /** Named field for the status returned from the script. */ 25 public static final String STATUS_FIELD_NAME = "status"; 26 27 /** Failure message to be returned from JS. */ 28 public static final String JS_EXECUTION_STATUS_UNSUCCESSFUL = 29 "Outcome selection script failed with status '%s' or returned unexpected result '%s'"; 30 31 /** Failure message to be returned from JS. */ 32 public static final String JS_EXECUTION_RESULT_INVALID = 33 "Result of outcome selection script result is invalid: %s"; 34 35 /** Named WASM module argument. */ 36 public static final String SCRIPT_ARGUMENT_NAME_IGNORED = "ignored"; 37 38 /** Success status code to be returned from JS. Other status codes are feature dependent. */ 39 public static final int JS_SCRIPT_STATUS_SUCCESS = 0; 40 41 /** Named WASM module argument. */ 42 public static final String WASM_MODULE_ARG_NAME = "wasmModule"; 43 44 /** Named WASM bytes argument. */ 45 public static final String WASM_MODULE_BYTES_ID = "__wasmModuleBytes"; 46 47 /** Named entry point for Rubidium scripts. */ 48 public static final String ENTRY_POINT_FUNC_NAME = "__rb_entry_point"; 49 } 50