This is an assumption, but as i was connecting to a website I saw the alert 'so and so website wants to install something to tor browser' and there was the 'Allow' button. I was going to retreat but the alert showed for just a second and went away on its own. It's probably safe to assume that my browser just got violated right?
It is hard to determine exactly what happened when you say:
It flashed for just a second and went away
While on normal web browsers such behavior may be indicative of malicious or unsolicited installation or download attempts by shady websites, on something like TOR it is unlikely. TOR was developed for user security and privacy and is meant to block or deny all such attempts (see: https://www.torproject.org/download/download). For example, 'NoScript' installed on TOR would not let common JS scripts to execute on your browser. It is unlikely that something got installed in the background on TOR implicitly.
So yes, while theoretically it is possible, practically, it is unlikely unless you explicitly allowed an add-on or plugin to install (which it does not seem like you did).
There is always the possibility of your browser being attacked by multiple means including the websites you visit having malicious code right on them. The best thing you can do when you notice odd behavior such as your momentary pop-up is to run antivirus with internet protection, of which there are many. It's also a good idea to have anti-malware running as well.