A Chrome extension to fetch and view Salesforce object metadata directly from your browser.
MetaForce Extension
This Chrome Extension background script is designed to interact with Salesforce APIs, focusing primarily on fetching metadata and data related to Salesforce objects. It listens for various actions triggered from the extension's content scripts and responds accordingly. Key functionalities include:
Authentication: It fetches Salesforce's session ID (SID) stored in cookies to authenticate API requests.
Data Retrieval: Uses the SID to fetch object metadata and actual data from Salesforce.
Multi-Domain Support: It can look for SID cookies across multiple Salesforce domains (salesforce.com and cloudforce.com).
Message Handling: Listens for messages such as 'CONTENT_SCRIPT_LOADED' and 'fetchMetadata' to perform specific tasks.
URL Monitoring: Monitors URL changes to refresh data when needed.
The script is well-organized, handling various edge cases and providing utility functions for sending success and error messages. It employs a mix of promises and callbacks for asynchronous operations. Overall, this script serves as a robust backbone for a Chrome Extension that aims to seamlessly interact with Salesforce.
Read more
Authentication: It fetches Salesforce's session ID (SID) stored in cookies to authenticate API requests.
Data Retrieval: Uses the SID to fetch object metadata and actual data from Salesforce.
Multi-Domain Support: It can look for SID cookies across multiple Salesforce domains (salesforce.com and cloudforce.com).
Message Handling: Listens for messages such as 'CONTENT_SCRIPT_LOADED' and 'fetchMetadata' to perform specific tasks.
URL Monitoring: Monitors URL changes to refresh data when needed.
The script is well-organized, handling various edge cases and providing utility functions for sending success and error messages. It employs a mix of promises and callbacks for asynchronous operations. Overall, this script serves as a robust backbone for a Chrome Extension that aims to seamlessly interact with Salesforce.
Source Manifest.json
{"update_url": "https://clients2.google.com/service/update2/crx", "manifest_version": 3, "name": "MetaForce", "version": "0.5", "description": "A Chrome extension to fetch and view Salesforce object metadata directly from your browser.", "permissions": ["cookies"], "host_permissions": [ "https://*.salesforce.com/*", "https://*.visual.force.com/*", "https://*.lightning.force.com/*", "https://*.cloudforce.com/*", "https://*.visualforce.com/*" ], "background": { "service_worker": "background.js" }, "content_scripts": [ { "matches": [ "https://*.salesforce.com/*", "https://*.visual.force.com/*", "https://*.lightning.force.com/*", "https://*.cloudforce.com/*", "https://*.visualforce.com/*" ], "js": ["contentScript.js"], "run_at": "document_idle" } ], "action": { "default_popup": "popup/popup.html", "default_icon": { "16": "icons/icon.png", "48": "icons/icon.png", "128": "icons/icon.png" } }}
Read more