@@ -180,74 +180,67 @@ void DisposeIsolateWhenPossible(Isolate* isolate) {
180180 WeakRef::Init (context);
181181
182182
183- auto blob_methods =
184- " const BLOB_STORE = new Map();\n "
185- " URL.createObjectURL = function (object, options = null) {\n "
186- " try {\n "
187- " if (object instanceof Blob || object instanceof File) {\n "
188- " const id = NSUUID.UUID().UUIDString;\n "
189- " const ret = `blob:nativescript/${id}`;\n "
190- " BLOB_STORE.set(ret, {\n "
191- " blob: object,\n "
192- " type: object?.type,\n "
193- " ext: options?.ext,\n "
194- " });\n "
195- " return ret;\n "
196- " }\n "
197- " } catch (error) {\n "
198- " return null;\n "
199- " }\n "
200- " return null;\n "
201- " };\n "
202- " \n "
203- " URL.revokeObjectURL = function (url) {\n "
204- " BLOB_STORE.delete(url);\n "
205- " };\n "
206- " \n "
207- " const InternalAccessor = class {};\n "
208- " \n "
209- " InternalAccessor.getData = function (url) {\n "
210- " return BLOB_STORE.get(url);\n "
211- " };\n "
212- " \n "
213- " URL.InternalAccessor = InternalAccessor;\n "
214- " Object.defineProperty(URL.prototype, 'searchParams', {\n "
215- " get() {\n "
216- " if (this._searchParams == null) {\n "
217- " this._searchParams = new URLSearchParams(this.search);\n "
218- " Object.defineProperty(this._searchParams, '_url', {\n "
219- " enumerable: false,\n "
220- " writable: false,\n "
221- " value: this,\n "
222- " });\n "
223- " \n "
224- " this._searchParams._append = this._searchParams.append;\n "
225- " this._searchParams.append = function (name, value) {\n "
226- " this._append(name, value);\n "
227- " this._url.search = this.toString();\n "
228- " };\n "
229- " \n "
230- " this._searchParams._delete = this._searchParams.delete;\n "
231- " this._searchParams.delete = function (name) {\n "
232- " this._delete(name);\n "
233- " this._url.search = this.toString();\n "
234- " };\n "
235- " \n "
236- " this._searchParams._set = this._searchParams.set;\n "
237- " this._searchParams.set = function (name, value) {\n "
238- " this._set(name, value);\n "
239- " this._url.search = this.toString();\n "
240- " };\n "
241- " \n "
242- " this._searchParams._sort = this._searchParams.sort;\n "
243- " this._searchParams.sort = function () {\n "
244- " this._sort();\n "
245- " this._url.search = this.toString();\n "
246- " };\n "
247- " }\n "
248- " return this._searchParams;\n "
249- " },\n "
250- " });" ;
183+ auto blob_methods = R"js(
184+ const BLOB_STORE = new Map();
185+ URL.createObjectURL = function (object, options = null) {
186+ try {
187+ if (object instanceof Blob || object instanceof File) {
188+ const id = java.util.UUID.randomUUID().toString();
189+ const ret = `blob:nativescript/${id}`;
190+ BLOB_STORE.set(ret, {
191+ blob: object,
192+ type: object?.type,
193+ ext: options?.ext,
194+ });
195+ return ret;
196+ }
197+ } catch (error) {
198+ return null;
199+ }
200+ return null;
201+ };
202+ URL.revokeObjectURL = function (url) {
203+ BLOB_STORE.delete(url);
204+ };
205+ const InternalAccessor = class {};
206+ InternalAccessor.getData = function (url) {
207+ return BLOB_STORE.get(url);
208+ };
209+ URL.InternalAccessor = InternalAccessor;
210+ Object.defineProperty(URL.prototype, 'searchParams', {
211+ get() {
212+ if (this._searchParams == null) {
213+ this._searchParams = new URLSearchParams(this.search);
214+ Object.defineProperty(this._searchParams, '_url', {
215+ enumerable: false,
216+ writable: false,
217+ value: this,
218+ });
219+ this._searchParams._append = this._searchParams.append;
220+ this._searchParams.append = function (name, value) {
221+ this._append(name, value);
222+ this._url.search = this.toString();
223+ };
224+ this._searchParams._delete = this._searchParams.delete;
225+ this._searchParams.delete = function (name) {
226+ this._delete(name);
227+ this._url.search = this.toString();
228+ };
229+ this._searchParams._set = this._searchParams.set;
230+ this._searchParams.set = function (name, value) {
231+ this._set(name, value);
232+ this._url.search = this.toString();
233+ };
234+ this._searchParams._sort = this._searchParams.sort;
235+ this._searchParams.sort = function () {
236+ this._sort();
237+ this._url.search = this.toString();
238+ };
239+ }
240+ return this._searchParams;
241+ },
242+ });
243+ )js" ;
251244
252245
253246 v8::Local<v8::Script> script;
0 commit comments