Both Ubuntu and Firefox aren't free software but a mixture of free and non-free software.
Also they both allow to easily remove the ads unlike any fully proprietary software.