Reverse Engineering an Extension

hackingthebrowser

I’m reverse engineering the Tab Snooze extension. This extension lets you “close unnecessary tabs and make them magically reappear when you need them.”

Here is the file system for this extension. I downloaded the files using Chrome Extension Source Viewer. alt text

Looking in the manifest.json file, it requires the following permissions:

"permissions": [
        "tabs",
        "alarms",
        "storage",
        "notifications",
        "idle",
        "<all_urls>"
    ]

It has a browser action which ‘snoozes’ the current tab and background script ‘background.js’ that uses the jquery and moment.js libraries. The content-script.js creates an angular.js app (which I don’t know anything about) that handles the majority of the extension’s functionality. I believe the background.js script has functions that deal with getting info from or changing the browser. It contains functions such as getting all existing tabs or creating a new tab.

The manifest.json also includes the commands API which lets you create keyboard commands. Each command references a function defined in background.js. 

"commands": {
        "_execute_browser_action": {
            "suggested_key": {
                "default": "Alt+S"
            },
            "description": "Snooze active tab"
        },
        "repeat_last_snooze": {
            "suggested_key": {
                "default": "Alt+Shift+S"
            },
            "description": "Repeat last snooze action"
        },
        "open_snoozed_list": {
            "suggested_key": {
                "default": "Alt+Shift+L"
            },
            "description": "Open snoozed tabs list"
        },
        "new_todo_page": {
            "suggested_key": {
                "default": "Ctrl+Shift+1"
            },
            "description": "New todo tab",
            "global": true
        }
    }
Written on April 21, 2018