Chapter 2 The Mechanism behind Extensions. How “Extensions” are implemented.

Slides:



Advertisements
Similar presentations
Samsung Smart TV is a web-based application running on an application engine installed on digital TVs connected to the Internet.
Advertisements

Cascading Style Sheets (CSS). Cascading Style Sheets With the explosive growth of the World Wide Web, designers and programmers quickly explored and reached.
CSS Internet Engineering Spring 2014 Bahador Bakhshi CE & IT Department, Amirkabir University of Technology.
HTML Overview - Cascading Style Sheets (CSS). Before We Begin Make a copy of one of your HTML file you have previously created Make a copy of one of your.
Standards and Increasing Maintainability on Web- based Systems James Eaton SE4112/16/2006.
The Web Warrior Guide to Web Design Technologies
Firefox Addon development tutorial 谢烜
Advanced Object-Oriented Programming Features
Mozilla Technologies Sept. 30, History of Mozilla Mosaic -> Netscape 1.0 -> Netscape 5.0 Netscape 5.0 was announced to be an Open Source project.
Presented by IBM developer Works ibm.com/developerworks/ 2006 January – April © 2006 IBM Corporation. Making the most of Creating Eclipse plug-ins.
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
Web Tailor Basics.
Configuration Management
4.01B Authoring Languages and Web Authoring Software 4.01 Examine webpage development and design.
XML on the Web: is it still relevant? O'Neil D. Delpratt.
Cascading Style Sheets CS3505. What are CSS? Method for adding style attributes consistently to HML tags Cascading because styles are applied in order.
Week 4.  Three ways to apply CSS: Inline CSS Internal style sheets ( header style information) External style sheets.
JavaScript, Fifth Edition Chapter 1 Introduction to JavaScript.
Chapter 5 Java Script And Forms JavaScript, Third Edition.
Lesley Bross, August 29, 2010 ArcGIS 10 add-in glossary.
Database Technical Session By: Prof. Adarsh Patel.
DOM and JavaScript Aryo Pinandito.
CISC474 - JavaScript 03/02/2011. Some Background… Great JavaScript Guides: –
Chapter 12 Cascading Style Sheets: Part II The Web Warrior Guide to Web Design Technologies.
Review IDIA 619 Spring 2013 Bridget M. Blodgett. HTML A basic HTML document looks like this: Sample page Sample page This is a simple sample. HTML user.
SEG3210 DHTML Tutorial. DHTML DHTML is a combination of technologies used to create dynamic and interactive Web sites. –HTML - For creating text and image.
DSpace UI Alexey Maslov. DSpace in general A digital library tool useful for storage, maintenance, and retrieval of digital documents Two types of interaction:
Working with the XML Document Object Model ©NIITeXtensible Markup Language/Lesson 7/Slide 1 of 44 Objectives In this lesson, you will learn to: *Identify.
JavaScript, Fourth Edition
INTRODUCTION TO JAVASCRIPT AND DOM Internet Engineering Spring 2012.
Tutorial 10 Programming with JavaScript
COP 3813 Intro to Internet Computing Prof. Roy Levow Lecture 3.
Guided Notes Ch. 9 ADT and Modules Ch. 10 Object-Oriented Programming PHP support for OOP and Assignment 4 Term project proposal C++ and Java Designer.
Introduction to Programming the WWW I CMSC Summer 2003 Lecture 7.
Building Rich Web Applications with Ajax Linda Dailey Paulson IEEE – Computer, October 05 (Vol.38, No.10) Presented by Jingming Zhang.
Chapter 6 Introducing Cascading Style Sheets Principles of Web Design, 4 th Edition.
Department of Computer Science Internet Performance Measurements using Firefox Extensions Scot L. DeDeo Professor Craig Wills.
Object Oriented Software Development
Advanced Web Development Instructor: Thomas Bombach.
Graphical Enablement In this presentation… –What is graphical enablement? –Introduction to newlook dialogs and tools used to graphical enable System i.
Programming with Java © 2002 The McGraw-Hill Companies, Inc. All rights reserved. 1 McGraw-Hill/Irwin Chapter 5 Creating Classes.
Review of the DOM Node properties and methods Some ways of accessing nodes Appending, copying and removing nodes Event handling – Inline – Scripting –
Protecting Browsers from Extension Vulnerabilities Paper by: Adam Barth, Adrienne Porter Felt, Prateek Saxena at University of California, Berkeley and.
4.01B Authoring Languages and Web Authoring Software 4.01 Examine webpage development and design.
HTML Concepts and Techniques Fifth Edition Chapter 1 Introduction to HTML.
Unit 13 –JQuery Basics Instructor: Brent Presley.
Rich Internet Applications 2. Core JavaScript. The importance of JavaScript Many choices open to the developer for server-side Can choose server technology.
28 Copyright © 2009, Oracle. All rights reserved. Customizing the Oracle Business Intelligence User Interface.
Object orientation and Packaging in Java Object Orientation and Packaging Introduction: After completing this chapter, you will be able to identify.
- WE’LL LOOK AT THE POSITION PROPERTY AND HOW CSS RESOLVES CONFLICTS BETWEEN STYLING INSTRUCTIONS The position property; CSS specificity hierarchy.
Maven. Introduction Using Maven (I) – Installing the Maven plugin for Eclipse – Creating a Maven Project – Building the Project Understanding the POM.
Customizing Share Document Previews Will Abson Senior Integrations Engineer and Share Extras Project Lead
© 2010 IBM Corporation RESTFul Service Modelling in Rational Software Architect April, 2011.
Introduction to ASP.NET, Second Edition2 Chapter Objectives.
#SummitNow The Share Widget Library 13 th November 2013 Dave Draper
Week-9 (Lecture-1) XML DTD (Data Type Document): An XML document with correct syntax is called "Well Formed". An XML document validated against a DTD is.
Javascript Prof. Wenwen Li School of Geographical Sciences and Urban Planning 5644 Coor Hall
Chapter 2 Build Your First Project A Step-by-Step Approach 2 Exploring Microsoft Visual Basic 6.0 Copyright © 1999 Prentice-Hall, Inc. By Carlotta Eaton.
XP Chapter 1 Succeeding in Business with Microsoft Office Access 2003: A Problem-Solving Approach 1 Level 2 Objectives: Understanding and Creating Table.
Working with Cascading Style Sheets
JavaScript, Sixth Edition
Tutorial 10 Programming with JavaScript
CVS revisions UML diagram
14 A Brief Look at JavaScript and jQuery.
Revision.
Web Systems Development (CSC-215)
Introduction to Classes and Objects
Fundaments of Game Design
Web Client Side Technologies Raneem Qaddoura
Plug-In Architecture Pattern
Presentation transcript:

Chapter 2 The Mechanism behind Extensions

How “Extensions” are implemented

How is it different from plugins

Plugin is a small application that interacts with the main application to provide a certain function.

Firefox Extension is like dynamically applied software patch

Patch?

Index: layout/xul/base/src/nsNativeScrollbarFrame.cpp =================================================================== RCS file: /cvsroot/mozilla/layout/xul/base/src/nsNativeScrollbarFrame.cpp,v retrieving revision 1.22 diff -u -6 -p -r1.22 nsNativeScrollbarFrame.cpp --- layout/xul/base/src/nsNativeScrollbarFrame.cpp31 Dec :13: layout/xul/base/src/nsNativeScrollbarFrame.cpp28 Jul :06: ,6 +342,68 nsNativeScrollbarFrame::Hookup() ‏ if (!curpos || error) ‏ return; scrollbar->SetPosition(curpos); } +NS_IMETHODIMP +nsNativeScrollbarFrame::Paint(nsPresContext* aPresContext, + nsIRenderingContext& aRenderingContext, + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer, + PRUint32 aFlags) ‏ +{ + if (NS_FRAME_IS_UNFLOWABLE & mState) { + return NS_OK; + } + + if (NS_FRAME_PAINT_LAYER_BACKGROUND == aWhichLayer) { + PaintSelf(aPresContext, aRenderingContext, aDirtyRect); + } + + return nsBoxFrame::Paint(aPresContext, aRenderingContext, aDirtyRect, + aWhichLayer); +}

Applied dynamically?

Actually,

Key technologies used in Firefox

XUL CSS JavaScript XPCOM

Can all be overwritten and appended after they're built and installed

CSS

Cascading

When there are different rules matching the same element, the highest priority rule is assigned (The rule is overwritten)‏

box#content { height: 200px; border-width: 3px; } { height: 200px; border-style: solid; border-color: white; border-width: 3px; } box { height: 100px; border: 2px solid white; }

Rules are applied in the following order Firefox Internal Stylesheet ↓ Extension Stylesheet ↓ User Stylesheet

Extensions can overwrite Firefox stylesheets

Extension containing only stylesheets ↓ Theme

XUL

A subset of XML

Cascading feature like in CSS ↓ Doesn't exist in XML

A Unique feature of XUL

Overlay

This feature merges multiple XUL documents into one

Original XUL document Overlay XUL document New XUL document after merge

Methods other than overlay

Control XUL using JavaScript and DOM

Comparing Overlay and JavaScript+DOM FlexibilityMaintainability OverlayLowHigh JavaScript+DOMHighLow

Use each one when appropriate

JavaScript

2 important traits

1 Strings, numbers, and functions are all treated as objects

2 No need for class definitions like in Java (Can add, remove, and overwrite properties dynamically)‏

Example var obj = new Object(); obj.objectProperty = new Object(); obj.objectProperty.newProperty = 'string' obj.objectProperty.parent = obj; obj.myself = obj;

Turn a function object into a property ↓ Becomes a method

Example var obj = new Object(); obj.name = 'Firefox'; function sayName() { alert(this.name); } obj.sayMyName = sayName; obj.sayMyName(); // says "Firefox"

Sample

Modification Override window.open() so that any attempt to open a Google gets blocked (*No ulterior motives)‏

window.__original__open = window.open; window.open = function(aURI, aName, aFlag) { if (aURI.indexOf('.google.') > -1) ‏ return null; return this.__original__open(aURI, aName, aFlag); }; window.open(' // will be blocked

Define a new method in the JavaScript extension ↓ Feature Appended

Replace existing method with JavaScript extension ↓ Functionality Change

XPCOM

Existing XPCOM component features ↓ Basically cannot be configured

Reason 1 Components built using C/C++ is in binary, hence they cannot be configured

Reason 2 Components built using JavaScript need to be designated as configurable, otherwise they cannot be configured

But

Existing XPCOM components can be replaced

Keywords for XPCOM

・ Component ・ Interface ・ Contract ID

Component ↓ Small parts of applications (Libraries)‏

Interface ↓ Input/Output standard for components

Contract ID ↓ Name to identify components

Create a component with Same Interface Same Name as an existing component

Then

You can replace the existing XPCOM component with the user created one

Summary XULOverlay+DOM CSSCascading JavaScriptMethod overload XPCOMReplace component

Different concept from plugins

EffectFormat Plugin Performs tasks requested by Firefox External application ExtensionModifies Firefox source codePatch

But it is no ordinary software patch

Because the patch application is dynamic

XUL CSS JavaScript Are all interpretive, so they don't require compilers

Firefox can be configured and modified in every way after it is built and installed

↓ Extension traits

Add/RemovePossibilities PluginEasyLimited Conventional patchDifficultUnlimited ExtensionEasyUnlimited

Conclusion

Extensions are very powerful customization tools when compared to plugins and conventional patches