vomebook commited on
Commit ·
c6dfdc2
1
Parent(s): 8f78cde
Remove unconsumed Reader mini-player resume event fallback
Browse files
static/search/reader-host/application/navigation.js
CHANGED
|
@@ -166,8 +166,7 @@
|
|
| 166 |
url.hash = "";
|
| 167 |
url.searchParams.delete("bookmark");
|
| 168 |
url.searchParams.delete("bookmark_source");
|
| 169 |
-
|
| 170 |
-
else root.dispatchEvent(new CustomEvent("voice-reader-resume", { detail: url.href }));
|
| 171 |
});
|
| 172 |
back.className = "reader-speech-mini-back";
|
| 173 |
const play = button("暂停", () => /** @type {HTMLElement | null} */ (inFrame(target, "#speech-play"))?.click());
|
|
|
|
| 166 |
url.hash = "";
|
| 167 |
url.searchParams.delete("bookmark");
|
| 168 |
url.searchParams.delete("bookmark_source");
|
| 169 |
+
options.resume?.(url.href);
|
|
|
|
| 170 |
});
|
| 171 |
back.className = "reader-speech-mini-back";
|
| 172 |
const play = button("暂停", () => /** @type {HTMLElement | null} */ (inFrame(target, "#speech-play"))?.click());
|
tests/search/reader-navigation/test_reader_navigation_baseline.mjs
CHANGED
|
@@ -183,27 +183,24 @@ test('explicit fragment and bookmark opens bypass parked reuse without stopping
|
|
| 183 |
});
|
| 184 |
|
| 185 |
test('mini-player resumes the live Reader even when its iframe src contains opening targets', () => {
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
const
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
|
| 196 |
-
|
| 197 |
-
|
| 198 |
-
|
| 199 |
-
|
| 200 |
-
|
| 201 |
-
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
assert.equal(mini(), undefined);
|
| 205 |
-
nav.unmount(false);
|
| 206 |
-
}
|
| 207 |
});
|
| 208 |
|
| 209 |
test('pending background handoff survives opening another book and reopening the same frame', () => {
|
|
|
|
| 183 |
});
|
| 184 |
|
| 185 |
test('mini-player resumes the live Reader even when its iframe src contains opening targets', () => {
|
| 186 |
+
let resumed;
|
| 187 |
+
const resume = raw => {
|
| 188 |
+
const url = nav.prepare(raw, '/search/#/?q=book');
|
| 189 |
+
resumed = nav.mount(url, true);
|
| 190 |
+
nav.remember(url, {});
|
| 191 |
+
};
|
| 192 |
+
const {nav, mini, calls} = shellFixture(readerPath, {resume});
|
| 193 |
+
const ordinary = nav.parse(readerPath + '?id=book&ext=md&title=Book');
|
| 194 |
+
const url = nav.parse(ordinary.href + '&bookmark=saved&bookmark_source=source#opening');
|
| 195 |
+
const parked = parkSpeakingReader(nav, url);
|
| 196 |
+
mini().children.find(child => child.className === 'reader-speech-mini-back').dispatchEvent(new Event('click'));
|
| 197 |
+
assert.equal(resumed, parked.frame);
|
| 198 |
+
assert.equal(parked.reveals(), 1);
|
| 199 |
+
assert.equal(parked.frame.src, url.href, 'resuming must not reload the live iframe');
|
| 200 |
+
assert.equal(calls[0][3], ordinary.href, 'mini-player history must not carry stale position requests');
|
| 201 |
+
assert.equal(nav.backgroundReader, null);
|
| 202 |
+
assert.equal(mini(), undefined);
|
| 203 |
+
nav.unmount(false);
|
|
|
|
|
|
|
|
|
|
| 204 |
});
|
| 205 |
|
| 206 |
test('pending background handoff survives opening another book and reopening the same frame', () => {
|