**Task:**  
I need you to craft and improve and refine a Chrome extension that modifies CORS headers to prevent CORS policy errors on all requests and responses. The extension must be highly customizable, robust, and handle all edge cases flawlessly. Please act as an expert Chrome extension developer and provide a fully working version of the code that meets the following detailed requirements.

### **Requirements:**

1. **CORS Handling:**
   - Ensure **all CORS headers** (e.g., `Access-Control-Allow-Origin`, `Access-Control-Allow-Methods`, etc.) are **correctly set** on **all requests, responses, and preflight (OPTIONS) requests**.
   - The headers must be set with **extreme accuracy** to prevent **CORS policy errors** in any scenario.
   - **Default behavior**: The extension should automatically set appropriate CORS headers with valid values for **all resource types** and **content types**.
   - **Customizability**: The user should be able to define:
     - Which **resource types** or **methods** (GET, POST, etc.) the CORS headers should be applied to.
     - Which **domains** or **webpages** the CORS headers should apply to.
     - The **values** for each CORS header (either default or custom).
   - Ensure that all CORS headers are set **before the browser receives the response**.
  - ensure all of the requests origin matches the response allowed origins.
  - ensure that the access-control-allowed-orign header value on responses or resources should be equal to the requester's supplied orign.

2. **Real-time Feedback:**
   - Display **real-time feedback** in the extension popup, showing the **current domain or webpage** where the extension is actively modifying CORS headers.
   
3. **Customizability via Popup:**
   - Provide a **popup window** that allows the user to:
     - **Enable/disable** the extension.
     - **Customise** which headers are applied and their values.
     - **Select which domains or pages** the extension should operate on.
   - Ensure **easy-to-use controls** and a **user-friendly interface** for all customization options.

4. **Performance & Practicality:**
   - The extension should be **straightforward, fast, powerful, and reliable**.
   - It must work **flawlessly in real-world scenarios** and handle all requests and responses **without adding unnecessary complexity**.
   - Ensure the extension is **practically feasible** and does not introduce new issues, bottlenecks, or unintended side effects.
   
5. **Edge Cases, Errors & Bottlenecks:**
   - Handle **all edge cases** and potential errors (e.g., incorrect headers, conflicting policies) **flawlessly**.
   - Ensure the extension works in **all possible circumstances** without any **CORS-related errors**.
   - **Do not add logging**, rate limiting, or unnecessary complexity.

6. **Code Quality & Improvements:**
   - **Review and analyze** the existing code thoroughly.
   - **Improve the code quality** while keeping it **simple, efficient**, and **maintainable**.
   - Avoid unnecessary complexity and ensure the code is **robust** and **scalable**.
   - Use alternatives to `webRequestBlocking` since it only works with Manifest v2, and ensure compatibility with **Manifest v3**.

7. **UI/UX Improvements:**
   - **Improve the UI/UX** of the extension popup, ensuring it is intuitive and easy to navigate.
   - The popup should clearly show the **proxy status** and allow users to customize settings seamlessly.

8. **Final Output:**
   - Send the **fully working code** for the Chrome extension.
   - Ensure it is tested and works perfectly in **all circumstances**.
   - Make sure the extension is **ready for practical use**, with no CORS-related issues in any scenario.

### **Additional Instructions:**
1. Ensure the CORS headers are set with **authentic and valid values**.
2. **Do not add rate limiting** or **logging** that is not directly related to the extension's core functionality.
3. The extension should be **highly customizable** while being **efficient and simple**.
4. Always consider and handle **all potential consequences** of any modifications.
5. **Test thoroughly** to ensure the extension works **flawlessly** in real-world scenarios.
6. **Avoid unnecessary complexity** while ensuring that the extension is **robust** and handles all **edge cases**.
7. The extension should be able to **bypass CORS policy errors perfectly** in all situations, including **preflight requests** and **complex cross-origin requests**.

Please review, refine, and improve the provided code accordingly, and ensure the final version is **extremely powerful, efficient, and easy to customize**.

---

This version of the prompt adheres closely to the guidelines you've provided:

- **Specific and clear**: It breaks down the requirements in a step-by-step manner, ensuring clarity.
- **Clear instructions**: Each requirement is clearly numbered and action verbs are used.
- **Context provided**: This prompt specifies it’s for a Chrome extension related to CORS headers and provides all necessary background.
- **Parameters set**: Length, complexity, performance, and customization requirements are clearly defined.
- **Role and perspective**: The LLM is asked to take on the role of an expert Chrome extension developer.
- **Quality controls**: Instructions emphasize accuracy, testing, and avoiding unnecessary complexity.
- **Output format**: The final output is defined as a fully working Chrome extension code.