Navigation (F R6): update-global-history emission
On each successful (non-failed) load completion, BrowserPageGoanna emits msgUpdateGlobalHistory(url, reload=false); ProxySink forwards it over YAP. Added as a default-no-op IPageMessageSink method so existing sinks are unaffected. fail_test now also asserts the history side: a good data: load emits global-history (gh=1) while a failed load emits none (gh=0). FAIL-EVENT PASS. Daemon rebuilds + runs. Remaining in F R6: link-clicked + addUrlRedirect rules. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
c1147dd25c
commit
28bb52f98c
5 files changed
+16
-9
No files matched your search
@@ -18,6 +18,7 @@ void ProxySink::msgContentsSizeChanged(int32_t w, int32_t h) { mSrv->msgContents
|
||||
void ProxySink::msgScrolledTo(int32_t x, int32_t y) { mSrv->msgScrolledTo(mProxy, x, y); }
|
||||
void ProxySink::msgMetaViewportSet(double is, double mn, double mx, int32_t w, int32_t h, bool us) { mSrv->msgMetaViewportSet(mProxy, is, mn, mx, w, h, us); }
|
||||
void ProxySink::msgFailedLoad(const char* d, int32_t c, const char* u, const char* desc) { mSrv->msgFailedLoad(mProxy, d, c, u, desc); }
|
||||
void ProxySink::msgUpdateGlobalHistory(const char* u, bool reload) { mSrv->msgUpdateGlobalHistory(mProxy, u, reload); }
|
||||
|
||||
// ---- server ----------------------------------------------------------------
|
||||
JihadBrowserServer::JihadBrowserServer(const char* name, jihad::EngineHost& host)
|
||||
|
||||
@@ -33,6 +33,7 @@ public:
|
||||
void msgScrolledTo(int32_t x, int32_t y) override;
|
||||
void msgMetaViewportSet(double is, double mn, double mx, int32_t w, int32_t h, bool us) override;
|
||||
void msgFailedLoad(const char* domain, int32_t code, const char* url, const char* description) override;
|
||||
void msgUpdateGlobalHistory(const char* url, bool reload) override;
|
||||
private:
|
||||
JihadBrowserServer* mSrv;
|
||||
YapProxy* mProxy;
|
||||
|
||||
@@ -164,8 +164,9 @@ void BrowserPageGoanna::emitLoadAndLocation() {
|
||||
mSink.msgFailedLoad("Goanna", code, furl.c_str(), "Load failed");
|
||||
}
|
||||
mSink.msgLoadStopped();
|
||||
mSink.msgLocationChanged(mPage->CurrentUri().c_str(),
|
||||
mPage->CanGoBack(), mPage->CanGoForward());
|
||||
std::string uri = mPage->CurrentUri();
|
||||
mSink.msgLocationChanged(uri.c_str(), mPage->CanGoBack(), mPage->CanGoForward());
|
||||
if (!failed) mSink.msgUpdateGlobalHistory(uri.c_str(), false); // R6
|
||||
emitGeometry(); // R4: contents-size + meta-viewport once the page settled
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,6 +47,8 @@ public:
|
||||
int32_t height, bool userScalable) = 0;
|
||||
virtual void msgFailedLoad(const char* domain, int32_t code,
|
||||
const char* url, const char* description) = 0;
|
||||
// Optional event (default no-op so existing sinks need not override).
|
||||
virtual void msgUpdateGlobalHistory(const char* url, bool reload) { (void)url; (void)reload; }
|
||||
};
|
||||
|
||||
class BrowserPageGoanna
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
class CapSink : public jihad::IPageMessageSink {
|
||||
public:
|
||||
int failed = 0, stopped = 0; char url[512] = {0};
|
||||
int failed = 0, stopped = 0, gh = 0; char url[512] = {0};
|
||||
void msgPainted(int32_t) override {}
|
||||
void msgLoadStarted() override {}
|
||||
void msgLoadProgress(int32_t) override {}
|
||||
@@ -31,6 +31,7 @@ public:
|
||||
void msgFailedLoad(const char*, int32_t, const char* u, const char*) override {
|
||||
++failed; if (u) { strncpy(url, u, sizeof url - 1); }
|
||||
}
|
||||
void msgUpdateGlobalHistory(const char*, bool) override { ++gh; }
|
||||
};
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
@@ -59,15 +60,16 @@ int main(int argc, char** argv) {
|
||||
const char* bad = "zzzbogus://nohandler/";
|
||||
page.openUrl(bad);
|
||||
page.pump(4000);
|
||||
printf("[fail] bad load: failed=%d stopped=%d url=%s\n", sink.failed, sink.stopped, sink.url);
|
||||
bool badOK = sink.failed >= 1 && sink.stopped >= 1;
|
||||
printf("[fail] bad load: failed=%d stopped=%d gh=%d url=%s\n", sink.failed, sink.stopped, sink.gh, sink.url);
|
||||
// A failed load emits msgFailedLoad and NOT global-history (R3 + R6).
|
||||
bool badOK = sink.failed >= 1 && sink.stopped >= 1 && sink.gh == 0;
|
||||
|
||||
// 2) A good load must NOT emit msgFailedLoad.
|
||||
sink.failed = 0;
|
||||
// 2) A good load must NOT emit msgFailedLoad but MUST emit global-history.
|
||||
sink.failed = 0; sink.gh = 0;
|
||||
page.openUrl("data:text/html,<body>ok</body>");
|
||||
page.pump(8000);
|
||||
printf("[fail] good load: failed=%d\n", sink.failed);
|
||||
bool goodOK = sink.failed == 0;
|
||||
printf("[fail] good load: failed=%d gh=%d\n", sink.failed, sink.gh);
|
||||
bool goodOK = sink.failed == 0 && sink.gh >= 1;
|
||||
|
||||
printf("[fail] badOK=%d goodOK=%d\n", badOK, goodOK);
|
||||
bool ok = badOK && goodOK;
|
||||
|
||||
Reference in new issue
Block a user