This issue is raised in https://chromium-review.googlesource.com/c/chromium/src/+/818666/9..10/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/detached-context.https.html.
There might be a bug in WebIDL binding implementation. The IDL attributes in SecureContext is setup by InstallConditionalFeatures(). But once calling frame.remove(), then the InstallConditionalFeatures() is never called. I don't know why it is caused exactly but I guess that the binding implementation might determine that the context is no longer secure becuase the frame was already removed.
// The following test code will be failed.
// Because InstallConditionalFeatures() is not called for unknown reason.
frame.remove();
assert_equals(r.active.state, 'activated');
// If we change the test as follows, it works well
// because `const unused = r.active` causes calling InstallConditionalFeatures().
// The r.active's V8 wrapper object is constructed before calling frame.remove().
const unused = r.active;
frame.remove();
assert_equals(r.active.state, 'activated');
Comment 1 by falken@chromium.org
, Jun 19 2018