Skip to content

Commit cbabb77

Browse files
committed
internalUrlToPath: Use the entire URL, not just the pathname
1 parent 5f0ff7c commit cbabb77

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

dist-web/app.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,8 @@
132132
return `${wordPressSiteUrl2}${wordPressPath}`;
133133
},
134134
internalUrlToPath(internalUrl) {
135-
return new URL(internalUrl).pathname.substr(scopePath.length);
135+
const url = new URL(internalUrl);
136+
return url.toString().substr(url.origin.length).substr(scopePath.length);
136137
},
137138
async HTTPRequest(request) {
138139
return await backend.sendMessage({
@@ -197,10 +198,10 @@
197198
}
198199

199200
// src/web/config.js
200-
var serviceWorkerUrl = "http://127.0.0.1:8777/service-worker.js";
201+
var serviceWorkerUrl = "https://wasm.wordpress.net/service-worker.js";
201202
var serviceWorkerOrigin = new URL(serviceWorkerUrl).origin;
202203
var wordPressSiteUrl = serviceWorkerOrigin;
203-
var wasmWorkerUrl = "http://127.0.0.1:8778/iframe-worker.html";
204+
var wasmWorkerUrl = "https://wasm-worker.wordpress.net/iframe-worker.php";
204205
var wasmWorkerOrigin = new URL(wasmWorkerUrl).origin;
205206
var wasmWorkerBackend = "iframe";
206207

src/web/library.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,9 @@ export async function createWordPressWorker({
143143
pathToInternalUrl(wordPressPath) {
144144
return `${wordPressSiteUrl}${wordPressPath}`;
145145
},
146-
internalUrlToPath(internalUrl) {
147-
return new URL(internalUrl).pathname.substr(scopePath.length);
146+
internalUrlToPath(internalUrl) {
147+
const url = new URL(internalUrl);
148+
return url.toString().substr(url.origin.length).substr(scopePath.length);
148149
},
149150
async HTTPRequest(request) {
150151
return await backend.sendMessage({

0 commit comments

Comments
 (0)