I am trying to build a chrome://offline-internals/ functionality. The chrome://offline-internals/ shows among many things, the pages which are stored for offline viewing, and this feature are only available in mobile chrome browser.
The page at chrome://offline-internals/ basically has a HTML page which I found using view-source:chrome://offline-internals/. I the HTML a javascript is referenced (offline_internals.js), which in turn has nested javascript referenced. I downloaded all referenced javascript in my local folder since chrome doesn't allow access to chrome://resources/js for referencing js pages.
After downloading, I tried to open HTML page and I got an error as below
cr.m.js:107 Uncaught TypeError: chrome.send is not a function
at sendWithPromise (cr.m.js:107)
at OfflineInternalsBrowserProxyImpl.getStoredPages (offline_internals_browser_proxy.js:30)
at refreshAll (offline_internals.js:64)
at HTMLDocument.initialize (offline_internals.js:248)
This basically comes in a file called cr.m.js
in the below function
export function sendWithPromise(methodName, var_args) {
const args = Array.prototype.slice.call(arguments, 1);
const promiseResolver = new PromiseResolver();
const id = methodName + '_' + createUid();
chromeSendResolverMap[id] = promiseResolver;
chrome.send(methodName, [id].concat(args)); <-- Error
return promiseResolver.promise;
}
I tried to open chrome://offline-internals/ and set my breakpoint at the above function and that time chrome.send
was found to be a function and when I ran my custom HTML page having same source and references, it says chrome.send
is not a function.
Probably, the chrome
instance given to my script vis-a-vis the one given to chrome://offline-internals/ is a different one.
What can I do to resolve this issue ?
P.S.: This link chrome://offline-internals/ will open in your mobile chrome browser only.
P.S.: All downloaded files are present at this path, in case you wish to see: https://easyupload.io/9x332s
from Replicate chrome://offline-internals/ functionality - chrome.send is not a function
No comments:
Post a Comment